@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
package/dist/utils/utils.js
CHANGED
|
@@ -119,5 +119,28 @@ function logWarning() {
|
|
|
119
119
|
console.warn(message); // eslint-disable-line no-console
|
|
120
120
|
}
|
|
121
121
|
}
|
|
122
|
+
/**
|
|
123
|
+
* Stop default event handling and propagation
|
|
124
|
+
*/
|
|
125
|
+
|
|
126
|
+
function stopEvent(event) {
|
|
127
|
+
let {
|
|
128
|
+
preventDefault = true,
|
|
129
|
+
stopPropagation = true,
|
|
130
|
+
stopImmediatePropagation = false
|
|
131
|
+
} = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
|
|
132
|
+
|
|
133
|
+
if (preventDefault) {
|
|
134
|
+
event.preventDefault();
|
|
135
|
+
}
|
|
136
|
+
|
|
137
|
+
if (stopPropagation) {
|
|
138
|
+
event.stopPropagation();
|
|
139
|
+
}
|
|
140
|
+
|
|
141
|
+
if (stopImmediatePropagation) {
|
|
142
|
+
event.stopImmediatePropagation();
|
|
143
|
+
}
|
|
144
|
+
}
|
|
122
145
|
|
|
123
|
-
export { colorFromBackground, debounceByAnimationFrame, focusFirstFocusableElement, hexToRgba, isDev, isElementFocusable, logWarning, rgbFromHex, rgbFromString, throttle, uid };
|
|
146
|
+
export { colorFromBackground, debounceByAnimationFrame, focusFirstFocusableElement, hexToRgba, isDev, isElementFocusable, logWarning, rgbFromHex, rgbFromString, stopEvent, throttle, uid };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@gitlab/ui",
|
|
3
|
-
"version": "39.
|
|
3
|
+
"version": "39.4.0",
|
|
4
4
|
"description": "GitLab UI Components",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"main": "dist/index.js",
|
|
@@ -17,8 +17,7 @@
|
|
|
17
17
|
"files": [
|
|
18
18
|
"src",
|
|
19
19
|
"dist",
|
|
20
|
-
"scss_to_js"
|
|
21
|
-
"documentation"
|
|
20
|
+
"scss_to_js"
|
|
22
21
|
],
|
|
23
22
|
"scripts": {
|
|
24
23
|
"build": "NODE_ENV=production rollup -c",
|
|
@@ -56,17 +55,13 @@
|
|
|
56
55
|
"generate:component": "plop"
|
|
57
56
|
},
|
|
58
57
|
"dependencies": {
|
|
59
|
-
"@
|
|
58
|
+
"@popperjs/core": "^2.11.2",
|
|
60
59
|
"bootstrap-vue": "2.20.1",
|
|
61
|
-
"copy-to-clipboard": "^3.0.8",
|
|
62
60
|
"dompurify": "^2.3.6",
|
|
63
61
|
"echarts": "^5.2.1",
|
|
64
|
-
"highlight.js": "^10.6.0",
|
|
65
62
|
"iframe-resizer": "^4.3.2",
|
|
66
|
-
"js-beautify": "^1.8.8",
|
|
67
63
|
"lodash": "^4.17.20",
|
|
68
64
|
"portal-vue": "^2.1.6",
|
|
69
|
-
"url-search-params-polyfill": "^5.0.0",
|
|
70
65
|
"vue-runtime-helpers": "^1.1.2"
|
|
71
66
|
},
|
|
72
67
|
"peerDependencies": {
|
|
@@ -88,7 +83,7 @@
|
|
|
88
83
|
"@babel/preset-env": "^7.10.2",
|
|
89
84
|
"@gitlab/eslint-plugin": "12.0.1",
|
|
90
85
|
"@gitlab/stylelint-config": "4.0.0",
|
|
91
|
-
"@gitlab/svgs": "2.
|
|
86
|
+
"@gitlab/svgs": "2.11.0",
|
|
92
87
|
"@rollup/plugin-commonjs": "^11.1.0",
|
|
93
88
|
"@rollup/plugin-node-resolve": "^7.1.3",
|
|
94
89
|
"@rollup/plugin-replace": "^2.3.2",
|
|
@@ -132,7 +127,6 @@
|
|
|
132
127
|
"postcss-loader": "^3.0.0",
|
|
133
128
|
"postcss-scss": "^2.1.1",
|
|
134
129
|
"prettier": "2.2.1",
|
|
135
|
-
"pug": "^2.0.3",
|
|
136
130
|
"puppeteer": "11.0.0",
|
|
137
131
|
"raw-loader": "^0.5.1",
|
|
138
132
|
"rollup": "^2.53.1",
|
|
@@ -149,10 +143,10 @@
|
|
|
149
143
|
"stylelint": "14.3.0",
|
|
150
144
|
"stylelint-config-prettier": "9.0.3",
|
|
151
145
|
"stylelint-prettier": "2.0.0",
|
|
152
|
-
"vue": "
|
|
146
|
+
"vue": "2.6.11",
|
|
153
147
|
"vue-jest": "4.0.0-rc.0",
|
|
154
148
|
"vue-loader": "^15.8.3",
|
|
155
|
-
"vue-template-compiler": "
|
|
149
|
+
"vue-template-compiler": "2.6.11"
|
|
156
150
|
},
|
|
157
151
|
"release": {
|
|
158
152
|
"branches": [
|
|
@@ -27,6 +27,7 @@ export const limitedLayoutWidth = '990px'
|
|
|
27
27
|
export const black = '#000'
|
|
28
28
|
export const blackNormal = '#333'
|
|
29
29
|
export const white = '#fff'
|
|
30
|
+
export const whiteContrast = '#fff'
|
|
30
31
|
export const whiteNormal = '#f0f0f0'
|
|
31
32
|
export const whiteDark = '#eaeaea'
|
|
32
33
|
export const whiteTransparent = 'rgba(255, 255, 255, 0.8)'
|
|
@@ -2,6 +2,7 @@ import Vue from 'vue';
|
|
|
2
2
|
import { GlAvatarLabeled, GlBadge } from '../../../index';
|
|
3
3
|
import { GlTooltipDirective } from '../../../directives/tooltip';
|
|
4
4
|
import { avatarSizeOptions, avatarShapeOptions, tooltipPlacements } from '../../../utils/constants';
|
|
5
|
+
import avatarPath from '../../../../static/img/avatar.png';
|
|
5
6
|
import readme from './avatar_labeled.md';
|
|
6
7
|
|
|
7
8
|
Vue.directive('gl-tooltip', GlTooltipDirective);
|
|
@@ -13,7 +14,7 @@ const generateProps = ({
|
|
|
13
14
|
subLabel = '@gitlab',
|
|
14
15
|
size = 32,
|
|
15
16
|
shape = 'circle',
|
|
16
|
-
src =
|
|
17
|
+
src = avatarPath,
|
|
17
18
|
} = {}) => ({
|
|
18
19
|
label,
|
|
19
20
|
subLabel,
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { GlAvatarLink, GlAvatar, GlAvatarLabeled } from '../../../index';
|
|
2
2
|
import { avatarSizeOptions, avatarShapeOptions } from '../../../utils/constants';
|
|
3
|
+
import avatarPath from '../../../../static/img/avatar.png';
|
|
3
4
|
import readme from './avatar_link.md';
|
|
4
5
|
|
|
5
6
|
const components = { GlAvatarLink, GlAvatar, GlAvatarLabeled };
|
|
@@ -19,9 +20,7 @@ const generateLabelsProps = ({ label = 'GitLab User', subLabel = '@gitlab' } = {
|
|
|
19
20
|
subLabel,
|
|
20
21
|
});
|
|
21
22
|
|
|
22
|
-
const generateImageProps = ({
|
|
23
|
-
src = 'https://assets.gitlab-static.net/uploads/-/system/project/avatar/278964/logo-extra-whitespace.png?width=64',
|
|
24
|
-
} = {}) => ({
|
|
23
|
+
const generateImageProps = ({ src = avatarPath } = {}) => ({
|
|
25
24
|
src,
|
|
26
25
|
});
|
|
27
26
|
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { GlBreadcrumb } from '../../../index';
|
|
2
|
+
import avatarPath from '../../../../static/img/avatar.png';
|
|
2
3
|
import readme from './breadcrumb.md';
|
|
3
4
|
|
|
4
5
|
const template = `
|
|
@@ -7,7 +8,7 @@ const template = `
|
|
|
7
8
|
>
|
|
8
9
|
<template #avatar>
|
|
9
10
|
<img alt=""
|
|
10
|
-
class="gl-breadcrumb-avatar-tile" src="
|
|
11
|
+
class="gl-breadcrumb-avatar-tile" src="${avatarPath}"
|
|
11
12
|
width="16"
|
|
12
13
|
height="16" />
|
|
13
14
|
</template>
|
|
@@ -128,8 +128,14 @@
|
|
|
128
128
|
}
|
|
129
129
|
}
|
|
130
130
|
|
|
131
|
-
.gl-dropdown-toggle
|
|
132
|
-
|
|
131
|
+
.gl-dropdown-toggle {
|
|
132
|
+
&.btn-block {
|
|
133
|
+
@include gl-justify-content-space-between;
|
|
134
|
+
}
|
|
135
|
+
|
|
136
|
+
.gl-button-text {
|
|
137
|
+
@include gl-display-inline-flex;
|
|
138
|
+
}
|
|
133
139
|
}
|
|
134
140
|
|
|
135
141
|
.gl-new-dropdown-button-text {
|
|
@@ -173,7 +179,8 @@
|
|
|
173
179
|
}
|
|
174
180
|
|
|
175
181
|
.dropdown-icon-only {
|
|
176
|
-
.dropdown-icon
|
|
182
|
+
.dropdown-icon,
|
|
183
|
+
.gl-button-icon.gl-button-icon {
|
|
177
184
|
@include gl-mr-0;
|
|
178
185
|
}
|
|
179
186
|
|
|
@@ -3,6 +3,7 @@ import { BModal } from 'bootstrap-vue';
|
|
|
3
3
|
import { merge } from 'lodash';
|
|
4
4
|
import CloseButton from '../../shared_components/close_button/close_button.vue';
|
|
5
5
|
import Button from '../button/button.vue';
|
|
6
|
+
import { logWarning } from '../../../utils/utils';
|
|
6
7
|
import Modal from './modal.vue';
|
|
7
8
|
import { modalButtonDefaults } from '~/utils/constants';
|
|
8
9
|
|
|
@@ -21,6 +22,10 @@ const BModalStub = merge({}, BModal.options, {
|
|
|
21
22
|
},
|
|
22
23
|
});
|
|
23
24
|
|
|
25
|
+
jest.mock('../../../utils/utils', () => ({
|
|
26
|
+
logWarning: jest.fn(),
|
|
27
|
+
}));
|
|
28
|
+
|
|
24
29
|
describe('Modal component', () => {
|
|
25
30
|
let wrapperListeners;
|
|
26
31
|
let wrapper;
|
|
@@ -217,6 +222,21 @@ describe('Modal component', () => {
|
|
|
217
222
|
});
|
|
218
223
|
});
|
|
219
224
|
|
|
225
|
+
describe('accessible name warning', () => {
|
|
226
|
+
it.each`
|
|
227
|
+
description | title | ariaLabel | showWarning
|
|
228
|
+
${'is logged when there is no title or ariaLabel'} | ${undefined} | ${undefined} | ${true}
|
|
229
|
+
${'is not logged when there is a title'} | ${'modal title'} | ${undefined} | ${false}
|
|
230
|
+
${'is not logged when there is an ariaLabel'} | ${undefined} | ${'modal title'} | ${false}
|
|
231
|
+
${'is not logged when there is a title and ariaLabel'} | ${'modal title'} | ${'modal title'} | ${false}
|
|
232
|
+
`('$description', ({ title, ariaLabel, showWarning }) => {
|
|
233
|
+
createComponent({ props: { title, ariaLabel } });
|
|
234
|
+
|
|
235
|
+
const calledTimes = showWarning ? 1 : 0;
|
|
236
|
+
expect(logWarning).toHaveBeenCalledTimes(calledTimes);
|
|
237
|
+
});
|
|
238
|
+
});
|
|
239
|
+
|
|
220
240
|
it('it binds visible property to the BModal visible property', async () => {
|
|
221
241
|
createComponent({ stubModal: false });
|
|
222
242
|
|
|
@@ -6,7 +6,7 @@ import {
|
|
|
6
6
|
modalButtonDefaults,
|
|
7
7
|
modalSizeOptions,
|
|
8
8
|
} from '../../../utils/constants';
|
|
9
|
-
import { focusFirstFocusableElement } from '../../../utils/utils';
|
|
9
|
+
import { focusFirstFocusableElement, logWarning } from '../../../utils/utils';
|
|
10
10
|
import CloseButton from '../../shared_components/close_button/close_button.vue';
|
|
11
11
|
import GlButton from '../button/button.vue';
|
|
12
12
|
|
|
@@ -79,6 +79,11 @@ export default {
|
|
|
79
79
|
required: false,
|
|
80
80
|
default: false,
|
|
81
81
|
},
|
|
82
|
+
ariaLabel: {
|
|
83
|
+
type: String,
|
|
84
|
+
required: false,
|
|
85
|
+
default: '',
|
|
86
|
+
},
|
|
82
87
|
},
|
|
83
88
|
computed: {
|
|
84
89
|
shouldRenderModalOk() {
|
|
@@ -96,6 +101,13 @@ export default {
|
|
|
96
101
|
);
|
|
97
102
|
},
|
|
98
103
|
},
|
|
104
|
+
mounted() {
|
|
105
|
+
if (!this.ariaLabel && !this.title) {
|
|
106
|
+
logWarning(
|
|
107
|
+
'[gl-modal]: Accessible name for modal missing. Please add title prop or aria-label.'
|
|
108
|
+
);
|
|
109
|
+
}
|
|
110
|
+
},
|
|
99
111
|
methods: {
|
|
100
112
|
show() {
|
|
101
113
|
this.$refs.modal.show();
|
|
@@ -165,6 +177,7 @@ export default {
|
|
|
165
177
|
:title-tag="titleTag"
|
|
166
178
|
:size="size"
|
|
167
179
|
:visible="visible"
|
|
180
|
+
:aria-label="ariaLabel || title"
|
|
168
181
|
v-bind="$attrs"
|
|
169
182
|
lazy
|
|
170
183
|
:modal-class="['gl-modal', modalClass]"
|
|
@@ -0,0 +1,171 @@
|
|
|
1
|
+
import { mount } from '@vue/test-utils';
|
|
2
|
+
import { nextTick } from 'vue';
|
|
3
|
+
import { GL_DROPDOWN_HIDDEN, GL_DROPDOWN_SHOWN, POPPER_CONFIG } from '../constants';
|
|
4
|
+
import GlBaseDropdown from './base_dropdown.vue';
|
|
5
|
+
|
|
6
|
+
const destroyPopper = jest.fn();
|
|
7
|
+
const updatePopper = jest.fn();
|
|
8
|
+
const mockCreatePopper = jest.fn().mockImplementation(() => ({
|
|
9
|
+
destroy: destroyPopper,
|
|
10
|
+
update: updatePopper,
|
|
11
|
+
}));
|
|
12
|
+
|
|
13
|
+
jest.mock('@popperjs/core', () => ({
|
|
14
|
+
createPopper: (...args) => mockCreatePopper(...args),
|
|
15
|
+
}));
|
|
16
|
+
|
|
17
|
+
const DEFAULT_BTN_TOGGLE_CLASSES = [
|
|
18
|
+
'btn',
|
|
19
|
+
'btn-default',
|
|
20
|
+
'btn-md',
|
|
21
|
+
'gl-button',
|
|
22
|
+
'dropdown-toggle',
|
|
23
|
+
'gl-dropdown-toggle',
|
|
24
|
+
];
|
|
25
|
+
|
|
26
|
+
describe('base dropdown', () => {
|
|
27
|
+
let wrapper;
|
|
28
|
+
|
|
29
|
+
const buildWrapper = (propsData, slots = {}) => {
|
|
30
|
+
wrapper = mount(GlBaseDropdown, {
|
|
31
|
+
propsData: {
|
|
32
|
+
toggleId: 'dropdown-toggle-btn-1',
|
|
33
|
+
...propsData,
|
|
34
|
+
},
|
|
35
|
+
slots,
|
|
36
|
+
attachTo: document.body,
|
|
37
|
+
});
|
|
38
|
+
};
|
|
39
|
+
|
|
40
|
+
beforeEach(() => {
|
|
41
|
+
jest.clearAllMocks();
|
|
42
|
+
});
|
|
43
|
+
|
|
44
|
+
const findDropdownToggle = () => wrapper.find('.btn.gl-dropdown-toggle');
|
|
45
|
+
const findDropdownMenu = () => wrapper.find('.dropdown-menu');
|
|
46
|
+
|
|
47
|
+
describe('popper.js instance', () => {
|
|
48
|
+
it('should initialize popper.js instance with toggle and menu elements and config for left-aligned menu', async () => {
|
|
49
|
+
await buildWrapper();
|
|
50
|
+
expect(mockCreatePopper).toHaveBeenCalledWith(
|
|
51
|
+
findDropdownToggle().element,
|
|
52
|
+
findDropdownMenu().element,
|
|
53
|
+
{ ...POPPER_CONFIG, placement: 'bottom-start' }
|
|
54
|
+
);
|
|
55
|
+
});
|
|
56
|
+
|
|
57
|
+
it('should initialize popper.js instance with toggle and menu elements and config for right-aligned menu', async () => {
|
|
58
|
+
await buildWrapper({ right: true });
|
|
59
|
+
expect(mockCreatePopper).toHaveBeenCalledWith(
|
|
60
|
+
findDropdownToggle().element,
|
|
61
|
+
findDropdownMenu().element,
|
|
62
|
+
{ ...POPPER_CONFIG, placement: 'bottom-end' }
|
|
63
|
+
);
|
|
64
|
+
});
|
|
65
|
+
|
|
66
|
+
it('should update popper instance when component is updated', async () => {
|
|
67
|
+
await buildWrapper();
|
|
68
|
+
await findDropdownToggle().trigger('click');
|
|
69
|
+
await wrapper.setProps({ category: 'tertiary' });
|
|
70
|
+
expect(updatePopper).toHaveBeenCalled();
|
|
71
|
+
});
|
|
72
|
+
|
|
73
|
+
it('should destroy popper instance when component is destroyed', async () => {
|
|
74
|
+
await buildWrapper();
|
|
75
|
+
wrapper.destroy();
|
|
76
|
+
expect(destroyPopper).toHaveBeenCalled();
|
|
77
|
+
});
|
|
78
|
+
});
|
|
79
|
+
|
|
80
|
+
describe('renders content to the default slot', () => {
|
|
81
|
+
const defaultContent = 'Some content here';
|
|
82
|
+
const slots = { default: defaultContent };
|
|
83
|
+
|
|
84
|
+
it('renders the content', () => {
|
|
85
|
+
buildWrapper({}, slots);
|
|
86
|
+
expect(wrapper.find('.gl-new-dropdown-inner').html()).toContain(defaultContent);
|
|
87
|
+
});
|
|
88
|
+
});
|
|
89
|
+
|
|
90
|
+
describe.each`
|
|
91
|
+
props | toggleClasses
|
|
92
|
+
${{}} | ${[]}
|
|
93
|
+
${{ toggleText: 'toggleText' }} | ${[]}
|
|
94
|
+
${{ toggleText: 'toggleText', icon: 'close' }} | ${['dropdown-icon-text']}
|
|
95
|
+
${{ icon: 'close' }} | ${['dropdown-icon-only']}
|
|
96
|
+
${{ icon: 'close', toggleText: 'toggleText', textSrOnly: true }} | ${['dropdown-icon-only']}
|
|
97
|
+
${{ icon: 'close', textSrOnly: true }} | ${['dropdown-icon-only']}
|
|
98
|
+
${{ toggleText: 'toggleText', noCaret: true }} | ${['dropdown-toggle-no-caret']}
|
|
99
|
+
`('dropdown with props $props', ({ props, toggleClasses }) => {
|
|
100
|
+
beforeEach(async () => {
|
|
101
|
+
buildWrapper(props);
|
|
102
|
+
|
|
103
|
+
await nextTick();
|
|
104
|
+
});
|
|
105
|
+
|
|
106
|
+
it(`sets toggle button classes to '${toggleClasses}'`, () => {
|
|
107
|
+
const classes = findDropdownToggle().classes().sort();
|
|
108
|
+
|
|
109
|
+
expect(classes).toEqual([...DEFAULT_BTN_TOGGLE_CLASSES, ...toggleClasses].sort());
|
|
110
|
+
});
|
|
111
|
+
});
|
|
112
|
+
|
|
113
|
+
describe.each`
|
|
114
|
+
toggleClass | expectedClasses | type
|
|
115
|
+
${'my-class'} | ${[...DEFAULT_BTN_TOGGLE_CLASSES, 'my-class']} | ${'string'}
|
|
116
|
+
${{ 'my-class': true }} | ${[...DEFAULT_BTN_TOGGLE_CLASSES, 'my-class']} | ${'object'}
|
|
117
|
+
${['cls-1', 'cls-2']} | ${[...DEFAULT_BTN_TOGGLE_CLASSES, 'cls-1', 'cls-2']} | ${'array'}
|
|
118
|
+
${null} | ${[...DEFAULT_BTN_TOGGLE_CLASSES]} | ${'null'}
|
|
119
|
+
`('with toggle classes', ({ toggleClass, expectedClasses, type }) => {
|
|
120
|
+
beforeEach(async () => {
|
|
121
|
+
buildWrapper({ toggleClass });
|
|
122
|
+
|
|
123
|
+
await nextTick();
|
|
124
|
+
});
|
|
125
|
+
|
|
126
|
+
it(`class is inherited from toggle class of type ${type}`, () => {
|
|
127
|
+
expect(findDropdownToggle().classes().sort()).toEqual(
|
|
128
|
+
expect.arrayContaining(expectedClasses.sort())
|
|
129
|
+
);
|
|
130
|
+
});
|
|
131
|
+
});
|
|
132
|
+
|
|
133
|
+
describe('toggle visibility', () => {
|
|
134
|
+
beforeEach(() => {
|
|
135
|
+
buildWrapper();
|
|
136
|
+
});
|
|
137
|
+
|
|
138
|
+
it('should toggle menu visibility on toggle button click ', async () => {
|
|
139
|
+
const toggle = findDropdownToggle();
|
|
140
|
+
const menu = findDropdownMenu();
|
|
141
|
+
|
|
142
|
+
// open menu clicking toggle btn
|
|
143
|
+
await toggle.trigger('click');
|
|
144
|
+
expect(menu.classes('show')).toBe(true);
|
|
145
|
+
expect(toggle.attributes('aria-expanded')).toBe('true');
|
|
146
|
+
expect(wrapper.emitted(GL_DROPDOWN_SHOWN).length).toBe(1);
|
|
147
|
+
|
|
148
|
+
// close menu clicking toggle btn again
|
|
149
|
+
await toggle.trigger('click');
|
|
150
|
+
expect(menu.classes('show')).toBe(false);
|
|
151
|
+
expect(toggle.attributes('aria-expanded')).toBeUndefined();
|
|
152
|
+
expect(wrapper.emitted(GL_DROPDOWN_HIDDEN).length).toBe(1);
|
|
153
|
+
});
|
|
154
|
+
|
|
155
|
+
it('should close the menu when Escape is pressed inside menu and focus toggle', async () => {
|
|
156
|
+
const toggle = findDropdownToggle();
|
|
157
|
+
const menu = findDropdownMenu();
|
|
158
|
+
|
|
159
|
+
// open menu clicking toggle btn
|
|
160
|
+
await toggle.trigger('click');
|
|
161
|
+
expect(menu.classes('show')).toBe(true);
|
|
162
|
+
|
|
163
|
+
// close menu pressing ESC on it
|
|
164
|
+
await menu.trigger('keydown.esc');
|
|
165
|
+
expect(menu.classes('show')).toBe(false);
|
|
166
|
+
expect(toggle.attributes('aria-expanded')).toBeUndefined();
|
|
167
|
+
expect(wrapper.emitted(GL_DROPDOWN_HIDDEN).length).toBe(1);
|
|
168
|
+
expect(toggle.element).toHaveFocus();
|
|
169
|
+
});
|
|
170
|
+
});
|
|
171
|
+
});
|