@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,7 +0,0 @@
|
|
|
1
|
-
var description = "The friendly-wrap component lets you wrap text in a predictable way by appending [`<wbr>`] elements\nto specific break-symbols.\n\n[`<wbr>`]: https://developer.mozilla.org/en-US/docs/Web/HTML/Element/wbr\n\n## Internet Explorer 11\n\nIE11 doesn't support the `<wbr>` element: <https://caniuse.com/#search=wbr>\nTo use this component on IE11, you'll need some CSS to preserve its behaviour:\n\n```css\nwbr {\n display: inline-block;\n}\n```\n\n## Usage\n\n### Default\n\nBy default, `GlFriendlyWrap` wraps text with slashes (`/`) as the break-symbol, which is especially\nuseful when displaying paths or URLs:\n\n```html\n<gl-friendly-wrap text=\"/some/file/path\" />\n```\n\nThe code above renders to the following HTML:\n\n```html\n<span class=\"text-break\">/<wbr>some/<wbr>file/<wbr>path</span>\n```\n\n### Custom symbols\n\nMultiple custom break-symbols can be defined via the `GlFriendlyWrap` prop:\n\n```html\n<gl-friendly-wrap\n :symbols=\"[';', '-', '.']\"\n text=\"some;text-that.needs;to-be.wrapped\"\n/>\n```\n\nWhich renders to:\n\n```html\n<span class=\"text-break\">some;<wbr>text-<wbr>that.<wbr>needs;<wbr>to-<wbr>be.<wbr>wrapped</span>\n```\n\n### Break words\n\nSymbols can be words too:\n\n```html\n<gl-friendly-wrap\n :symbols=\"['and']\"\n text=\"it goes on and on and on and on\"\n/>\n```\n\nWhich renders to:\n\n```html\n<span class=\"text-break\">it goes on and<wbr> on and<wbr> on and<wbr> on</span>\n```\n";
|
|
2
|
-
|
|
3
|
-
var friendly_wrap_documentation = {
|
|
4
|
-
description
|
|
5
|
-
};
|
|
6
|
-
|
|
7
|
-
export default friendly_wrap_documentation;
|
package/dist/components/utilities/intersection_observer/intersection_observer.documentation.js
DELETED
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
var intersection_observer = "This intersection observer component is an invisible watcher that emits events when it appears and\ndissapears from view.\n\nIt acts a a vue-friendly wrapper around the [intersection observer API](https://developer.mozilla.org/en-US/docs/Web/API/Intersection_Observer_API).\n\nBecause of it's simplicity you can use it for a lot of different things.\nIt's especially helpful for the lazy loading of images, and infinite scrolling of lists.\n\nAnything slotted inside this component will become the element that is being observed.\n\nThis slot can also be used as a fallback for the browsers that don't support the intersection\nobserver, or in the case that the observer fails to work.\nFor example, adding a \"Fetch more posts\" button inside an observer that should fetch more posts\nautomatically when visible. If the observer fails to work for any reason, the button will still be\nclickable, and the experience preserved. Please use a fallback wherever possible as\n**the intersection observer API is not supported in IE11**.\n";
|
|
2
|
-
|
|
3
|
-
var description = /*#__PURE__*/Object.freeze({
|
|
4
|
-
__proto__: null,
|
|
5
|
-
'default': intersection_observer
|
|
6
|
-
});
|
|
7
|
-
|
|
8
|
-
var intersection_observer_documentation = {
|
|
9
|
-
description
|
|
10
|
-
};
|
|
11
|
-
|
|
12
|
-
export default intersection_observer_documentation;
|
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
var description = "The intersperse component separates a list of elements\nby a given character (the default is `, `).\n\nIt takes all direct descendants of its default slot and inserts\nthe given separator between each item:\n\n`item 1, item 2, item 3`\n\nOptionally the character used for separating each item and the last separator can be set\nindependently:\n\n* `separator=\"/\"` renders `item 1/item 2/item 3`\n* `lastSeparator=\" and \"` will render `item 1, item 2, and item 3`\n* `lastSeparator=\" and \"` and given two items will render `item 1 and item 2`\n\n**Note**:\n\nThe component provides an inline context since the result is wrapped in a `span`.\n\nAlso, whitespace elements that are direct children of the default-slot get removed to ensure\nconsistent formatting.\n\n## Usage\n\n### Default\n\n```html\n<gl-intersperse>\n <span>Item 1</span>\n <span>Item 2</span>\n <span>Item 3</span>\n</gl-intersperse>\n```\n\nThis renders to the following HTML:\n\n```html\n<span><span>Item 1</span>, <span>Item 2</span>, <span>Item 3</span></span>\n```\n\n### Custom Separator\n\nA custom separator can be defined via the `separator` prop:\n\n```html\n<gl-intersperse separator=\"/\">\n <span>Item 1</span>\n <span>Item 2</span>\n <span>Item 3</span>\n</gl-intersperse>\n```\n\nThis renders to the following HTML:\n\n```html\n<span><span>Item 1</span>/<span>Item 2</span>/<span>Item 3</span></span>\n```\n\n### Custom Last Separator\n\nA custom last separator can be defined via the `lastSeparator` prop:\n\n```html\n<gl-intersperse last-separator=\" and \">\n <span>Item 1</span>\n <span>Item 2</span>\n <span>Item 3</span>\n</gl-intersperse>\n```\n\nThis renders to the following HTML:\n\n```html\n<span><span>Item 1</span>, <span>Item 2</span>, and <span>Item 3</span></span>\n```\n\nA custom last separator used on two items will only place `lastSeparator` between them:\n\n```html\n<gl-intersperse last-separator=\" and \">\n <span>Item 1</span>\n <span>Item 2</span>\n</gl-intersperse>\n```\n\nThis renders to the following HTML:\n\n```html\n<span><span>Item 1</span> and <span>Item 2</span></span>\n```\n";
|
|
2
|
-
|
|
3
|
-
var intersperse_documentation = {
|
|
4
|
-
followsDesignSystem: false,
|
|
5
|
-
description
|
|
6
|
-
};
|
|
7
|
-
|
|
8
|
-
export default intersperse_documentation;
|
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
var description = "## Overview\n\nThe `GlSprintf` component lets you do `sprintf`-style string interpolation with\nchild components. Each placeholder in the translated string, provided via the\n`message` prop, becomes a slot that you can use to insert any components or\nmarkup in the rendered output.\n\n> NOTE: `gl-sprintf` does not translate the message for you; you must provide\n> it already translated. In the following examples, it is assumed that\n> a `gettext`-style `__` translation function is available in your Vue\n> templates.\n\n## Displaying messages with text between placeholders (e.g., links, buttons)\n\nSentences should not be split up into different messages, otherwise they may\nnot be translatable into certain languages. To help with this, `GlSprintf`\ninterprets placeholders suffixed with `Start` and `End` to indicate the\nboundaries of a component to display within the message. Any text between\nthem is passed, via the `content` scoped slot property, to the slot name common\nto the placeholders.\n\nFor example, using `linkStart` and `linkEnd` placeholders in a message defines\na `link` scoped slot:\n\n```html\n<div>\n <gl-sprintf :message=\"__('Learn more about %{linkStart}zones%{linkEnd}')\">\n <template #link=\"{ content }\">\n <gl-link\n href=\"https://cloud.google.com/compute/docs/regions-zones/regions-zones\"\n target=\"_blank\"\n >{{ content }}</gl-link>\n </template>\n </gl-sprintf>\n</div>\n```\n\nwill render as:\n\n```html\n<div>\n Learn more about\n <a\n href=\"https://cloud.google.com/compute/docs/regions-zones/regions-zones\"\n target=\"_blank\"\n rel=\"noopener noreferrer\"\n >zones</a>\n</div>\n```\n\nNote that _any_ arbitrary HTML tags or Vue component(s) can be used within\na scoped slot, and that the content passed to it can be used in any way at all;\nfor instance, as regular text, or in component attributes or slots.\n\nHere's a more complex example, which `<gl-sprintf>` lets you do in a breeze:\n\n```html\n<div>\n <gl-sprintf :message=\"__('Written by %{authorStart}someone%{authorEnd}')\">\n <template #author=\"{ content }\">\n <my-vue-component v-gl-tooltip=\"content\" @event=\"handleEvent(content)\">\n {{ content }}\n </my-vue-component>\n <p>\n {{ content }}\n <div>{{ content }}</div>\n </p>\n </template>\n </gl-sprintf>\n</div>\n```\n\nThis is not feasible in a JS-only solution, since arbitrary Vue components\ncannot easily be used. In addition, a JS-only solution is more likely to be\nprone to XSS attacks, as the Vue compiler isn't available to help protect\nagainst them.\n\n### Customizing start/end placeholders\n\nYou can customize the start and end placeholders that `GlSprintf` looks for\nusing the `placeholders` prop. For instance:\n\n```html\n<div>\n <gl-sprintf\n :message=\"__('Learn more about %{my_custom_start}zones%{my_custom_end}')\"\n :placeholders=\"{ link: ['my_custom_start', 'my_custom_end'] }\"\n >\n <template #link=\"{ content }\">\n <gl-link\n href=\"https://cloud.google.com/compute/docs/regions-zones/regions-zones\"\n target=\"_blank\"\n >{{ content }}</gl-link>\n </template>\n </gl-sprintf>\n</div>\n```\n\nThis can be useful if you are migrating an existing string to `GlSprintf` that\nuses different placeholder naming conventions, and don't want invalidate\nexisting translations.\n\n## Displaying components within a message\n\nUse slots to replace placeholders in the message with the slots' contents.\nThere is a slot for every placeholder in the message. For example, the `author`\nslot name can be used when there is an `%{author}` placeholder in the message:\n\n```html\n<script>\nexport default {\n data() {\n return {\n authorName: 'Some author',\n };\n },\n};\n</script>\n\n<template>\n <div>\n <gl-sprintf :message=\"__('Written by %{author}')\">\n <template #author>\n <span>{{ authorName }}</span>\n </template>\n </gl-sprintf>\n </div>\n</template>\n```\n\nThe example above renders to this HTML:\n\n```html\n<div>Written by <span>Some author</span></div>\n```\n\n## Usage caveats\n\n### White space\n\n`GlSprintf` does not handle white space in scoped slots specially; it is passed\nthrough and rendered just like regular text. This means that white space in the\nscoped slot templates *themselves*, including newlines and indentation, are\npassed through untouched (assuming the template compiler you're using doesn't\ntrim text nodes at compile time; `vue-template-compiler` preserves white space\nby default, for instance).\n\nMost of the time you don't need to worry about this, since\n[browsers normalize white space][1] automatically, but here's an example, using\npunctuation, where you might want to be conscious of the white space in the\ntemplate:\n\n```html\n<div>\n <gl-sprintf :message=\"__('Foo %{boldStart}bar%{boldEnd}!')\">\n <template #bold=\"{ content }\">\n <b>\n {{ content }}\n </b>\n </template>\n </gl-sprintf>\n</div>\n```\n\nAs written, the literal markup rendered would be:\n\n```html\n<div> Foo <b>\n bar\n </b>!\n</div>\n```\n\nwhere the white space (including newlines) before and after `bar` is exactly\nthe newlines and indentation in the source template. The browser will render\nthis as:\n\n<div> Foo <b>\n bar\n </b>!\n</div>\n\nNote the single space between `bar` and `!`. To avoid that, remove the\nwhite space in the template, or use `v-text`:\n\n```html\n<div>\n <gl-sprintf :message=\"__('Foo %{boldStart}bar%{boldEnd}!')\">\n <template #bold=\"{ content }\">\n <b>{{ content }}</b>\n <!-- OR -->\n <b v-text=\"content\" />\n </template>\n </gl-sprintf>\n</div>\n```\n\n### Miscellaneous\n\nWhile there are a lot of caveats here, you don't need to worry about reading\nthem _unless_ you find `GlSprintf` isn't rendering what you'd expect.\n\n- Since `GlSprintf` typically renders multiple elements, it can't be used as\n a component's root, it must be wrapped with at least one other root element,\n otherwise Vue will throw a `Multiple root nodes returned from render\n function` error.\n- If a slot for a given placeholder _isn't_ provided, the placeholder\n will be rendered as-is, e.g., literally `Written by %{author}` if the\n `author` slot _isn't_ provided, or literally `%{linkStart}foo%{linkEnd}` if\n the `link` slot isn't provided.\n- Content between `Start` and `End` placeholders is effectively thrown away if\n the scoped slot of the correct name doesn't consume the `content` property in\n some way, though the slot's components should still be rendered.\n- If there's no placeholder in the message for a provided named slot, the\n content of that slot is silently thrown away.\n- If only one of the `Start` or `End` placeholders is in the message, or they\n are in the wrong order, they are treated as plain slots, i.e., it is assumed\n there is no text to extract and pass to the scoped slot. This allows you to\n use plain slots whose names end in `Start` or `End`, e.g., `backEnd`, or\n `fromStart` in isolation, without their `Start`/`End` counterparts.\n- Text extraction between `Start` and `End` placeholders is only done one level\n deep. This is intentional, so as to avoid building complex sprintf messages\n that would better be implemented in components. As an example,\n `${linkStart}test%{icon}%{linkEnd}`, if provided both the `link` and `icon`\n slots, would pass `test%{icon}` as a literal string as content to the `link`\n scoped slot.\n- For more examples and edge cases, please see the test suite for `GlSprintf`.\n- To be successfully used in `GlSprintf`, slot names should:\n - start with a letter (`[A-Za-z]`)\n - only contain alpha-numeric characters (`[A-Za-z0-9]`), underscore (`_`) and\n dash (`-`),\n - should not end with underscore (`_`) or dash (`-`) So for example:\n `%{author}`, `%{author_name}`, `%{authorName}` or `%{author-name-100}` are\n all valid placeholders.\n\n## Internet Explorer 11\n\nThis component uses [`String.prototype.startsWith()`] and [`String.prototype.endsWith()`] under the\nhood. Make sure those methods are polyfilled if you plan on using the component on IE11.\n\n[1]: https://www.w3.org/TR/css-text-3/#white-space-phase-1\n[`String.prototype.startsWith()`]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/startsWith\n[`String.prototype.endsWith()`]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/endsWith\n";
|
|
2
|
-
|
|
3
|
-
var sprintf_documentation = {
|
|
4
|
-
description,
|
|
5
|
-
followsDesignSystem: false
|
|
6
|
-
};
|
|
7
|
-
|
|
8
|
-
export default sprintf_documentation;
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
var description = "The `GlTruncate` component lets you truncate the long texts with ellipsis.\n\n> **Tip:** Try resizing the side panel for truncation.\n\n## Usage\n\n```html\n<gl-truncate :text=\"text\" :position=\"position\" />\n```\n\nBy default, the ellipsis position is at the `end`.\n\nPro Tip: Truncating long filepaths from the `middle` / `start` can help preventing the important\ninformation in the end, i.e. filenames.\n";
|
|
2
|
-
|
|
3
|
-
var truncate_documentation = {
|
|
4
|
-
description
|
|
5
|
-
};
|
|
6
|
-
|
|
7
|
-
export default truncate_documentation;
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
var hover_load = "A Vue Directive to help with preloading resources when hovering over an element.\n\n## Usage\n\n```html\n<script>\nimport { GlHoverLoadDirective } from '@gitlab/ui';\n\nexport default {\n directives: { GlHoverLoadDirective },\n methods: {\n handlePreload() {\n fetch('some/endpoint');\n },\n },\n};\n</script>\n\n<template>\n <div v-gl-hover-load=\"handlePreload\">Hover me to preload</div>\n</template>\n```\n";
|
|
2
|
-
|
|
3
|
-
var description = /*#__PURE__*/Object.freeze({
|
|
4
|
-
__proto__: null,
|
|
5
|
-
'default': hover_load
|
|
6
|
-
});
|
|
7
|
-
|
|
8
|
-
var hover_load_documentation = {
|
|
9
|
-
description,
|
|
10
|
-
followsDesignSystem: false
|
|
11
|
-
};
|
|
12
|
-
|
|
13
|
-
export default hover_load_documentation;
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
var outside = "A Vue Directive to call a callback when a click occurs *outside* of the element\nthe directive is bound to. Any clicks on the element or any descendant elements are ignored.\n\n## Usage\n\n```html\n<script>\nimport { GlOutsideDirective as Outside } from '@gitlab/ui';\n\nexport default {\n directives: { Outside },\n methods: {\n onClick(event) {\n console.log('User clicked somewhere outside of this component', event);\n },\n },\n};\n</script>\n\n<template>\n <div v-outside=\"onClick\">Click anywhere but here</div>\n</template>\n```\n\n## Caveats\n\n- If a click event is stopped (e.g., via `event.stopPropagation()`) before it\n bubbles up to the `document`, it cannot be detected by `GlOutsideDirective`.\n- Clicks cannot be detected across document boundaries (e.g., across an\n `iframe` boundary), in either direction.\n";
|
|
2
|
-
|
|
3
|
-
var description = /*#__PURE__*/Object.freeze({
|
|
4
|
-
__proto__: null,
|
|
5
|
-
'default': outside
|
|
6
|
-
});
|
|
7
|
-
|
|
8
|
-
var outside_documentation = {
|
|
9
|
-
description,
|
|
10
|
-
followsDesignSystem: false
|
|
11
|
-
};
|
|
12
|
-
|
|
13
|
-
export default outside_documentation;
|
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
var description = "This directive can be used to get notified whenever a given element's size (width or height) changes\nand to retrieve the updated dimensions.\n\nUnder the hood, it leverages the [Resize Observer API](https://developer.mozilla.org/en-US/docs/Web/API/ResizeObserver).\nIf you use GitLab UI in an older browser which doesn't support the Resize Observer API,\nyou can use a [polyfill](https://github.com/que-etc/resize-observer-polyfill).\n\nThe directive accepts a callback as a value and passes on the received\n[contentRect](https://developer.mozilla.org/en-US/docs/Web/API/ResizeObserverEntry/contentRect)\nand the target element whenever a resize event gets triggered.\n\n```html\n<script>\nexport default {\n data() {\n return {\n width: 0,\n height: 0,\n };\n },\n methods: {\n handleResize({ contentRect: { width, height } }) {\n this.width = width;\n this.height = height;\n },\n },\n};\n</script>\n<template>\n <div v-gl-resize-observer-directive=\"handleResize\">\n <p>{{ width }} x {{ height }}</p>\n </div>\n</template>\n```\n\nThe observer can be toggled on or off by passing a boolean argument to the directive:\n\n```html\n<script>\nexport default {\n data() {\n return {\n shouldObserve: true,\n };\n },\n methods: {\n handleResize() {},\n },\n};\n</script>\n<template>\n <div v-gl-resize-observer-directive[shouldObserve]=\"handleResize\"></div>\n</template>\n```\n";
|
|
2
|
-
|
|
3
|
-
var resize_observer_documentation = {
|
|
4
|
-
followsDesignSystem: false,
|
|
5
|
-
description
|
|
6
|
-
};
|
|
7
|
-
|
|
8
|
-
export default resize_observer_documentation;
|
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
var description = "A Vue Directive to sanitize HTML to avoid any XSS vulnerabilities.\n\n## Usage\n\nThis directive can be used to sanitize HTML code which may contain user input, to prevent cross-site\nscripting (XSS) vulnerabilities.\n\nUnder the hood, it uses [DOMPurify](https://github.com/cure53/DOMPurify) to sanitize the provided HTML.\n\nDOMPurify will strip out dangerous HTML and will keep the safe HTML. You can refer complete list of\n[tags][1] and [attributes][2] allowed by DOMPurify.\n\n[1]: https://github.com/cure53/DOMPurify/blob/main/src/tags.js\n[2]: https://github.com/cure53/DOMPurify/blob/main/src/attrs.js\n\n## Example\n\n```html\n<script>\nimport { GlSafeHtmlDirective as SafeHtml } from '@gitlab/ui';\n\nexport default {\n directives: {\n SafeHtml,\n },\n data() {\n return {\n rawHtml: \"Hello! <script>alert('XSS')</script>\",\n };\n },\n};\n</script>\n\n<template>\n <div v-safe-html=\"rawHtml\"></div>\n</template>\n```\n\n## Advanced configuration\n\n```js\n// It allows only <b> tags\nconst config = { ALLOWED_TAGS: ['b'] };\n\n// It doesn't allow any html tags\nconst config = { ALLOWED_TAGS: [] };\n```\n\n```html\n<div v-safe-html:[config]=\"rawHtml\"></div>\n```\n\nFor advanced configuration options, please refer to [DOMPurify's documentation](https://github.com/cure53/DOMPurify#can-i-configure-dompurify).\n\n### Notes\n\n1. `target` attribute is not allowed by default - See <https://gitlab.com/gitlab-org/gitlab-ui/-/issues/1427>.\n1. To know more about other tips & caveats - See <https://gitlab.com/groups/gitlab-org/-/epics/4273#caveats>.\n";
|
|
2
|
-
|
|
3
|
-
var safe_html_documentation = {
|
|
4
|
-
followsDesignSystem: false,
|
|
5
|
-
description
|
|
6
|
-
};
|
|
7
|
-
|
|
8
|
-
export default safe_html_documentation;
|
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
var description = "A Vue directive to make the hyperlinks secure by default.\n\n## Security measures\n\n### rel\n\nWhen setting target to `_blank`, the rel attribute gets set automatically to `noopener noreferrer`,\nthis is done to avoid the `window.opener` [API exploit]. If you set the `rel` attribute manually,\nthis will overwrite the aforementioned logic.\n\n### href\n\nThis directive enforces \"safe\" URLs. What this means is that, if the provided `href`\ndoesn't point to a safe protocol (one of `http:`, `https:`, `mailto:` or `ftp:`), then it is\nreplaced with `about:blank` to prevent [URL injections].\n\n```html\n<script>\nimport { GlSafeLinkDirective as SafeLink } from '@gitlab/ui';\n\nexport default {\n data() {\n return {\n url: 'javascript:alert(1)',\n };\n },\n directives: { SafeLink },\n};\n</script>\n<template>\n <a v-safe-link href=\"url\" target=\"_blank\">Click</a>\n <!-- Renders to: <a href=\"about:blank\" target=\"_blank\">Click</a> -->\n</template>\n```\n\n[API exploit]: https://www.jitbit.com/alexblog/256-targetblank---the-most-underestimated-vulnerability-ever/\n[URL injections]: https://vuejs.org/v2/guide/security.html#Injecting-URLs\n";
|
|
2
|
-
|
|
3
|
-
var safe_link_documentation = {
|
|
4
|
-
followsDesignSystem: false,
|
|
5
|
-
description
|
|
6
|
-
};
|
|
7
|
-
|
|
8
|
-
export default safe_link_documentation;
|
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
import * as chartComponents from '../src/charts';
|
|
2
|
-
import * as components from '../src';
|
|
3
|
-
|
|
4
|
-
export const gitlabComponents = { ...components, ...chartComponents };
|
|
5
|
-
export const gitlabChartComponents = { ...chartComponents };
|
|
6
|
-
|
|
7
|
-
export const componentValidator = (componentName) =>
|
|
8
|
-
Object.keys(gitlabComponents).includes(componentName);
|
|
@@ -1,321 +0,0 @@
|
|
|
1
|
-
<script>
|
|
2
|
-
import BootstrapVue from 'bootstrap-vue';
|
|
3
|
-
import * as vueComponents from 'bootstrap-vue/src/components/index';
|
|
4
|
-
import { isString, isUndefined } from 'lodash';
|
|
5
|
-
import camelCase from 'lodash/camelCase';
|
|
6
|
-
import isArray from 'lodash/isArray';
|
|
7
|
-
import isFunction from 'lodash/isFunction';
|
|
8
|
-
import kebabCase from 'lodash/kebabCase';
|
|
9
|
-
import merge from 'lodash/merge';
|
|
10
|
-
import Vue from 'vue';
|
|
11
|
-
|
|
12
|
-
import GlBadge from '../../src/components/base/badge/badge.vue';
|
|
13
|
-
import GlTable from '../../src/components/base/table/table.vue';
|
|
14
|
-
import * as enumConstants from '../../src/utils/constants';
|
|
15
|
-
import { getValidationInfoText } from '../../src/utils/validation_utils';
|
|
16
|
-
|
|
17
|
-
import { gitlabComponents, gitlabChartComponents, componentValidator } from '../all_components';
|
|
18
|
-
|
|
19
|
-
import { getDocumentationFor } from '../components_documentation';
|
|
20
|
-
|
|
21
|
-
Vue.use(BootstrapVue);
|
|
22
|
-
|
|
23
|
-
function getPropDefaultValue(defaultValue) {
|
|
24
|
-
let returnValue = '';
|
|
25
|
-
if (isString(defaultValue)) {
|
|
26
|
-
returnValue = defaultValue;
|
|
27
|
-
}
|
|
28
|
-
if (isFunction(defaultValue) && !isArray(defaultValue)) {
|
|
29
|
-
returnValue = defaultValue();
|
|
30
|
-
}
|
|
31
|
-
if (!isString(defaultValue) && !isUndefined(defaultValue)) {
|
|
32
|
-
returnValue = JSON.stringify(defaultValue);
|
|
33
|
-
}
|
|
34
|
-
|
|
35
|
-
if (defaultValue === null || defaultValue === undefined) {
|
|
36
|
-
returnValue = String(defaultValue);
|
|
37
|
-
}
|
|
38
|
-
|
|
39
|
-
if (isString(returnValue)) returnValue = returnValue.replace(/"/g, "'");
|
|
40
|
-
return returnValue;
|
|
41
|
-
}
|
|
42
|
-
|
|
43
|
-
export default {
|
|
44
|
-
components: {
|
|
45
|
-
GlTable,
|
|
46
|
-
GlBadge,
|
|
47
|
-
},
|
|
48
|
-
props: {
|
|
49
|
-
componentName: {
|
|
50
|
-
type: String,
|
|
51
|
-
required: false,
|
|
52
|
-
default: 'Link',
|
|
53
|
-
validator: componentValidator,
|
|
54
|
-
},
|
|
55
|
-
},
|
|
56
|
-
computed: {
|
|
57
|
-
actualComponent() {
|
|
58
|
-
if (gitlabComponents[this.componentName]) {
|
|
59
|
-
return Vue.options.components[this.componentName] || {};
|
|
60
|
-
}
|
|
61
|
-
return {};
|
|
62
|
-
},
|
|
63
|
-
importSubDir() {
|
|
64
|
-
if (gitlabChartComponents[this.componentName]) {
|
|
65
|
-
return '/dist/charts';
|
|
66
|
-
}
|
|
67
|
-
return '';
|
|
68
|
-
},
|
|
69
|
-
actualComponentOptions() {
|
|
70
|
-
return this.actualComponent.options || {};
|
|
71
|
-
},
|
|
72
|
-
componentVModel() {
|
|
73
|
-
const { model } = this.actualComponentOptions;
|
|
74
|
-
|
|
75
|
-
if (!model) {
|
|
76
|
-
return null;
|
|
77
|
-
}
|
|
78
|
-
|
|
79
|
-
return {
|
|
80
|
-
prop: 'value',
|
|
81
|
-
event: 'input',
|
|
82
|
-
...model,
|
|
83
|
-
};
|
|
84
|
-
},
|
|
85
|
-
documentationInfo() {
|
|
86
|
-
return getDocumentationFor(this.componentName);
|
|
87
|
-
},
|
|
88
|
-
bootstrapComponentName() {
|
|
89
|
-
return this.documentationInfo.bootstrapComponent || '';
|
|
90
|
-
},
|
|
91
|
-
bootstrapComponentLink() {
|
|
92
|
-
return this.bootstrapComponentName.replace('b-', '').toLowerCase();
|
|
93
|
-
},
|
|
94
|
-
bootstrapComponentOptions() {
|
|
95
|
-
const bootstrapRegisterName = this.bootstrapComponentName
|
|
96
|
-
? this.bootstrapComponentName[0].toUpperCase() +
|
|
97
|
-
camelCase(this.bootstrapComponentName).substr(1)
|
|
98
|
-
: '';
|
|
99
|
-
const bootstrapComponent = vueComponents[bootstrapRegisterName];
|
|
100
|
-
return bootstrapComponent && bootstrapComponent.options ? bootstrapComponent.options : {};
|
|
101
|
-
},
|
|
102
|
-
componentPropertiesFields() {
|
|
103
|
-
return [
|
|
104
|
-
{ key: 'prop', label: 'Property' },
|
|
105
|
-
{ key: 'type', label: 'Type' },
|
|
106
|
-
{ key: 'required', label: 'Required' },
|
|
107
|
-
{ key: 'val', label: 'Value' },
|
|
108
|
-
];
|
|
109
|
-
},
|
|
110
|
-
eventsFields() {
|
|
111
|
-
return [
|
|
112
|
-
{ key: 'event', label: 'Event' },
|
|
113
|
-
{ key: 'args', label: 'Arguments' },
|
|
114
|
-
{ key: 'description', label: 'Description' },
|
|
115
|
-
];
|
|
116
|
-
},
|
|
117
|
-
componentProperties() {
|
|
118
|
-
const { props } = this.actualComponentOptions;
|
|
119
|
-
if (!props) return [];
|
|
120
|
-
if (this.documentationInfo.propsInfo) {
|
|
121
|
-
merge(props, this.documentationInfo.propsInfo);
|
|
122
|
-
}
|
|
123
|
-
return this.getPropsMap(props);
|
|
124
|
-
},
|
|
125
|
-
bootstrapComponentProperties() {
|
|
126
|
-
const { props } = this.bootstrapComponentOptions;
|
|
127
|
-
if (!props) return [];
|
|
128
|
-
if (this.documentationInfo.bootstrapPropsInfo) {
|
|
129
|
-
merge(props, this.documentationInfo.bootstrapPropsInfo);
|
|
130
|
-
}
|
|
131
|
-
return this.getPropsMap(props);
|
|
132
|
-
},
|
|
133
|
-
displayComponentProperties() {
|
|
134
|
-
let returnProps = Object.assign([], this.componentProperties);
|
|
135
|
-
const bootstrapProps = this.bootstrapComponentProperties;
|
|
136
|
-
|
|
137
|
-
if (bootstrapProps && bootstrapProps.length > 0) {
|
|
138
|
-
const applyableBootstrapProps = bootstrapProps.reduce((actualProps, prop) => {
|
|
139
|
-
const checkComp = returnProps.find((checkProp) => checkProp.prop === prop.prop);
|
|
140
|
-
if (!checkComp) {
|
|
141
|
-
// eslint-disable-next-line no-param-reassign, no-underscore-dangle
|
|
142
|
-
prop._cellVariants = { prop: 'info' };
|
|
143
|
-
actualProps.push(prop);
|
|
144
|
-
}
|
|
145
|
-
return actualProps;
|
|
146
|
-
}, []);
|
|
147
|
-
returnProps = returnProps.concat(applyableBootstrapProps);
|
|
148
|
-
}
|
|
149
|
-
|
|
150
|
-
return returnProps;
|
|
151
|
-
},
|
|
152
|
-
displayEvents() {
|
|
153
|
-
const events = this.documentationInfo.events || [];
|
|
154
|
-
if (this.componentVModel) {
|
|
155
|
-
const vModelEventIndex = events.findIndex(
|
|
156
|
-
({ event }) => event === this.componentVModel.event
|
|
157
|
-
);
|
|
158
|
-
if (vModelEventIndex === -1) {
|
|
159
|
-
events.push({
|
|
160
|
-
event: this.componentVModel.event,
|
|
161
|
-
args: [
|
|
162
|
-
{
|
|
163
|
-
arg: this.componentVModel.prop,
|
|
164
|
-
},
|
|
165
|
-
],
|
|
166
|
-
});
|
|
167
|
-
}
|
|
168
|
-
}
|
|
169
|
-
return events;
|
|
170
|
-
},
|
|
171
|
-
displaySlots() {
|
|
172
|
-
return this.documentationInfo.slots || [];
|
|
173
|
-
},
|
|
174
|
-
},
|
|
175
|
-
methods: {
|
|
176
|
-
getPropsMap: (props) =>
|
|
177
|
-
Object.keys(props).map((prop) => {
|
|
178
|
-
const selProp = props[prop];
|
|
179
|
-
|
|
180
|
-
// Copying over values if available from documentation definition
|
|
181
|
-
const propsInfo = {
|
|
182
|
-
prop: kebabCase(prop),
|
|
183
|
-
required: selProp.required,
|
|
184
|
-
additionalInfo: selProp.additionalInfo,
|
|
185
|
-
validationInfo: getValidationInfoText(selProp.validation),
|
|
186
|
-
};
|
|
187
|
-
|
|
188
|
-
// Figuring out the actual type of this property
|
|
189
|
-
const baseType = selProp.type || Object;
|
|
190
|
-
if (Array.isArray(baseType)) {
|
|
191
|
-
propsInfo.type = baseType.map((t) => t.name).join(' or ');
|
|
192
|
-
} else {
|
|
193
|
-
propsInfo.type = baseType.name;
|
|
194
|
-
}
|
|
195
|
-
|
|
196
|
-
// Getting the defaultValue and setting it then also the value
|
|
197
|
-
if (propsInfo.type === 'Function' && isFunction(selProp.default)) {
|
|
198
|
-
propsInfo.val = selProp.default.toString();
|
|
199
|
-
} else if ('default' in selProp) {
|
|
200
|
-
propsInfo.val = getPropDefaultValue(selProp.default);
|
|
201
|
-
} else {
|
|
202
|
-
propsInfo.val = '';
|
|
203
|
-
}
|
|
204
|
-
|
|
205
|
-
// If we have an enum on this property we assign it and look up its values in the constant file
|
|
206
|
-
if (selProp.enum) {
|
|
207
|
-
propsInfo.enum = selProp.enum;
|
|
208
|
-
propsInfo.enumValues = Object.values(enumConstants[selProp.enum]);
|
|
209
|
-
}
|
|
210
|
-
|
|
211
|
-
return propsInfo;
|
|
212
|
-
}),
|
|
213
|
-
},
|
|
214
|
-
};
|
|
215
|
-
</script>
|
|
216
|
-
|
|
217
|
-
<template>
|
|
218
|
-
<div v-if="actualComponent.options">
|
|
219
|
-
<div v-if="displayComponentProperties.length > 0">
|
|
220
|
-
<h3>Props</h3>
|
|
221
|
-
<gl-table
|
|
222
|
-
:items="displayComponentProperties"
|
|
223
|
-
:fields="componentPropertiesFields"
|
|
224
|
-
small
|
|
225
|
-
head-variant="default"
|
|
226
|
-
striped
|
|
227
|
-
>
|
|
228
|
-
<template #cell(prop)="field">
|
|
229
|
-
<div>
|
|
230
|
-
<span :title="field.item._cellVariants ? 'Inherited from Vue Bootstrap' : ''">
|
|
231
|
-
{{ field.value }}
|
|
232
|
-
<gl-badge
|
|
233
|
-
v-if="componentVModel && field.value === componentVModel.prop"
|
|
234
|
-
variant="info"
|
|
235
|
-
>
|
|
236
|
-
v-model
|
|
237
|
-
</gl-badge>
|
|
238
|
-
</span>
|
|
239
|
-
</div>
|
|
240
|
-
</template>
|
|
241
|
-
<template #cell(required)="data">
|
|
242
|
-
<span v-if="data.value === true">✅</span>
|
|
243
|
-
</template>
|
|
244
|
-
<template #cell(val)="data">
|
|
245
|
-
<code v-if="data.value">
|
|
246
|
-
{{ data.value }}
|
|
247
|
-
</code>
|
|
248
|
-
<template v-if="data.item.validationInfo">({{ data.item.validationInfo }})</template>
|
|
249
|
-
<div v-if="data.item.additionalInfo">
|
|
250
|
-
<i>{{ data.item.additionalInfo }}</i>
|
|
251
|
-
</div>
|
|
252
|
-
<template v-if="data.item.enum">
|
|
253
|
-
<div>
|
|
254
|
-
{{ data.item.enum }}: <i>{{ data.item.enumValues.join(', ') }}</i>
|
|
255
|
-
</div>
|
|
256
|
-
</template>
|
|
257
|
-
</template>
|
|
258
|
-
</gl-table>
|
|
259
|
-
</div>
|
|
260
|
-
|
|
261
|
-
<div v-if="displaySlots.length > 0">
|
|
262
|
-
<h4>Slots</h4>
|
|
263
|
-
<gl-table :items="displaySlots" small head-variant="default" striped />
|
|
264
|
-
</div>
|
|
265
|
-
|
|
266
|
-
<div v-if="displayEvents.length > 0">
|
|
267
|
-
<h4>Events</h4>
|
|
268
|
-
<gl-table :items="displayEvents" :fields="eventsFields" small head-variant="default" striped>
|
|
269
|
-
<template #cell(event)="field">
|
|
270
|
-
{{ field.value }}
|
|
271
|
-
<gl-badge v-if="componentVModel && field.value === componentVModel.event" variant="info">
|
|
272
|
-
v-model
|
|
273
|
-
</gl-badge>
|
|
274
|
-
</template>
|
|
275
|
-
<template #cell(args)="field">
|
|
276
|
-
<div
|
|
277
|
-
v-for="argument in field.value"
|
|
278
|
-
:key="`event-${field.item.event}-${argument.arg ? argument.arg : 'none'}`"
|
|
279
|
-
>
|
|
280
|
-
<code v-if="argument.arg">{{ argument.arg }}</code>
|
|
281
|
-
<span>{{ argument.description }}</span>
|
|
282
|
-
</div>
|
|
283
|
-
</template>
|
|
284
|
-
</gl-table>
|
|
285
|
-
</div>
|
|
286
|
-
|
|
287
|
-
<div v-if="componentVModel">
|
|
288
|
-
<h4>v-model</h4>
|
|
289
|
-
<gl-table
|
|
290
|
-
:items="[componentVModel]"
|
|
291
|
-
:fields="['prop', 'event']"
|
|
292
|
-
small
|
|
293
|
-
head-variant="default"
|
|
294
|
-
striped
|
|
295
|
-
/>
|
|
296
|
-
</div>
|
|
297
|
-
|
|
298
|
-
<h3>Import</h3>
|
|
299
|
-
|
|
300
|
-
<p>
|
|
301
|
-
<code>import { {{ componentName }} } from '@gitlab/ui{{ importSubDir }}';</code>
|
|
302
|
-
</p>
|
|
303
|
-
|
|
304
|
-
<template v-if="bootstrapComponentName">
|
|
305
|
-
<h3 id="under-the-hood">vue-bootstrap component</h3>
|
|
306
|
-
<p>
|
|
307
|
-
This component uses
|
|
308
|
-
<a
|
|
309
|
-
:href="`https://bootstrap-vue.org/docs/components/${bootstrapComponentLink}`"
|
|
310
|
-
target="blank"
|
|
311
|
-
><code><{{ bootstrapComponentName }}></code></a
|
|
312
|
-
>
|
|
313
|
-
from vue-bootstrap internally. So please take a look also there at their extensive
|
|
314
|
-
documentation.
|
|
315
|
-
</p>
|
|
316
|
-
</template>
|
|
317
|
-
</div>
|
|
318
|
-
<b-alert v-else show variant="warning">
|
|
319
|
-
No GitLab UI component found with the name {{ componentName }}
|
|
320
|
-
</b-alert>
|
|
321
|
-
</template>
|