@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.
Files changed (254) hide show
  1. package/CHANGELOG.md +21 -0
  2. package/dist/components/base/modal/modal.js +14 -2
  3. package/dist/components/base/new_dropdowns/base_dropdown/base_dropdown.js +240 -0
  4. package/dist/components/base/new_dropdowns/constants.js +20 -0
  5. package/dist/components/base/new_dropdowns/listbox/listbox.js +381 -0
  6. package/dist/components/base/new_dropdowns/listbox/listbox_item.js +77 -0
  7. package/dist/index.css +1 -1
  8. package/dist/index.css.map +1 -1
  9. package/dist/index.js +2 -0
  10. package/dist/utility_classes.css +1 -1
  11. package/dist/utility_classes.css.map +1 -1
  12. package/dist/utils/utils.js +24 -1
  13. package/package.json +6 -12
  14. package/scss_to_js/scss_variables.js +1 -0
  15. package/scss_to_js/scss_variables.json +5 -0
  16. package/src/components/base/avatar_labeled/avatar_labeled.stories.js +2 -1
  17. package/src/components/base/avatar_link/avatar_link.stories.js +2 -3
  18. package/src/components/base/breadcrumb/breadcrumb.md +1 -1
  19. package/src/components/base/breadcrumb/breadcrumb.stories.js +2 -1
  20. package/src/components/base/broadcast_message/broadcast_message.scss +1 -1
  21. package/src/components/base/button/button.scss +1 -1
  22. package/src/components/base/dropdown/dropdown.scss +10 -3
  23. package/src/components/base/dropdown/dropdown_item.scss +1 -0
  24. package/src/components/base/modal/modal.spec.js +20 -0
  25. package/src/components/base/modal/modal.vue +14 -1
  26. package/src/components/base/new_dropdowns/base_dropdown/base_dropdown.spec.js +171 -0
  27. package/src/components/base/new_dropdowns/base_dropdown/base_dropdown.vue +221 -0
  28. package/src/components/base/new_dropdowns/constants.js +22 -0
  29. package/src/components/base/new_dropdowns/listbox/listbox.md +71 -0
  30. package/src/components/base/new_dropdowns/listbox/listbox.spec.js +236 -0
  31. package/src/components/base/new_dropdowns/listbox/listbox.stories.js +276 -0
  32. package/src/components/base/new_dropdowns/listbox/listbox.vue +348 -0
  33. package/src/components/base/new_dropdowns/listbox/listbox_item.spec.js +104 -0
  34. package/src/components/base/new_dropdowns/listbox/listbox_item.vue +59 -0
  35. package/src/index.js +4 -0
  36. package/src/scss/utilities.scss +8 -0
  37. package/src/scss/utility-mixins/color.scss +4 -0
  38. package/src/scss/variables.scss +1 -0
  39. package/src/utils/utils.js +18 -0
  40. package/src/utils/utils.spec.js +41 -1
  41. package/dist/components/base/accordion/accordion.documentation.js +0 -8
  42. package/dist/components/base/accordion/accordion_item.documentation.js +0 -7
  43. package/dist/components/base/alert/alert.documentation.js +0 -13
  44. package/dist/components/base/avatar/avatar.documentation.js +0 -8
  45. package/dist/components/base/avatar_labeled/avatar_labeled.documentation.js +0 -8
  46. package/dist/components/base/avatar_link/avatar_link.documentation.js +0 -8
  47. package/dist/components/base/avatars_inline/avatars_inline.documentation.js +0 -13
  48. package/dist/components/base/badge/badge.documentation.js +0 -8
  49. package/dist/components/base/banner/banner.documentation.js +0 -8
  50. package/dist/components/base/breadcrumb/breadcrumb.documentation.js +0 -8
  51. package/dist/components/base/broadcast_message/broadcast_message.documentation.js +0 -8
  52. package/dist/components/base/button/button.documentation.js +0 -24
  53. package/dist/components/base/button_group/button_group.documentation.js +0 -8
  54. package/dist/components/base/card/card.documentation.js +0 -13
  55. package/dist/components/base/carousel/carousel.documentation.js +0 -8
  56. package/dist/components/base/collapse/collapse.documentation.js +0 -7
  57. package/dist/components/base/datepicker/datepicker.documentation.js +0 -7
  58. package/dist/components/base/daterange_picker/daterange_picker.documentation.js +0 -8
  59. package/dist/components/base/drawer/drawer.documentation.js +0 -8
  60. package/dist/components/base/dropdown/dropdown.documentation.js +0 -8
  61. package/dist/components/base/dropdown/dropdown_item.documentation.js +0 -7
  62. package/dist/components/base/filtered_search/filtered_search.documentation.js +0 -13
  63. package/dist/components/base/filtered_search/filtered_search_suggestion.documentation.js +0 -7
  64. package/dist/components/base/filtered_search/filtered_search_suggestion_list.documentation.js +0 -7
  65. package/dist/components/base/filtered_search/filtered_search_term.documentation.js +0 -12
  66. package/dist/components/base/filtered_search/filtered_search_token.documentation.js +0 -12
  67. package/dist/components/base/filtered_search/filtered_search_token_segment.documentation.js +0 -12
  68. package/dist/components/base/form/form.documentation.js +0 -7
  69. package/dist/components/base/form/form_checkbox/form_checkbox.documentation.js +0 -8
  70. package/dist/components/base/form/form_checkbox_tree/form_checkbox_tree.documentation.js +0 -12
  71. package/dist/components/base/form/form_combobox/form_combobox.documentation.js +0 -13
  72. package/dist/components/base/form/form_group/form_group.documentation.js +0 -7
  73. package/dist/components/base/form/form_input/form_input.documentation.js +0 -8
  74. package/dist/components/base/form/form_input_group/form_input_group.documentation.js +0 -8
  75. package/dist/components/base/form/form_radio/form_radio.documentation.js +0 -8
  76. package/dist/components/base/form/form_radio_group/form_radio_group.documentation.js +0 -8
  77. package/dist/components/base/form/form_select/form_select.documentation.js +0 -8
  78. package/dist/components/base/form/form_text/form_text.documentation.js +0 -14
  79. package/dist/components/base/form/form_textarea/form_textarea.documentation.js +0 -7
  80. package/dist/components/base/form/input_group_text/input_group_text.documentation.js +0 -12
  81. package/dist/components/base/icon/icon.documentation.js +0 -8
  82. package/dist/components/base/infinite_scroll/examples/index.js +0 -49
  83. package/dist/components/base/infinite_scroll/examples/infinite_scroll.all_items.example.js +0 -49
  84. package/dist/components/base/infinite_scroll/examples/infinite_scroll.basic.example.js +0 -62
  85. package/dist/components/base/infinite_scroll/examples/infinite_scroll.finite_total_items.example.js +0 -72
  86. package/dist/components/base/infinite_scroll/examples/infinite_scroll.large_fetched_items.example.js +0 -62
  87. package/dist/components/base/infinite_scroll/examples/infinite_scroll.reverse.example.js +0 -63
  88. package/dist/components/base/infinite_scroll/examples/infinite_scroll.small_fetched_items.example.js +0 -62
  89. package/dist/components/base/infinite_scroll/examples/infinite_scroll.two_way.example.js +0 -94
  90. package/dist/components/base/infinite_scroll/infinite_scroll.documentation.js +0 -8
  91. package/dist/components/base/keyset_pagination/keyset_pagination.documentation.js +0 -13
  92. package/dist/components/base/label/label.documentation.js +0 -8
  93. package/dist/components/base/link/link.documentation.js +0 -7
  94. package/dist/components/base/loading_icon/loading_icon.documentation.js +0 -8
  95. package/dist/components/base/markdown/markdown.documentation.js +0 -12
  96. package/dist/components/base/modal/modal.documentation.js +0 -8
  97. package/dist/components/base/nav/nav.documentation.js +0 -12
  98. package/dist/components/base/navbar/navbar.documentation.js +0 -12
  99. package/dist/components/base/paginated_list/paginated_list.documentation.js +0 -7
  100. package/dist/components/base/pagination/pagination.documentation.js +0 -8
  101. package/dist/components/base/path/path.documentation.js +0 -8
  102. package/dist/components/base/popover/popover.documentation.js +0 -5
  103. package/dist/components/base/search_box_by_click/search_box_by_click.documentation.js +0 -8
  104. package/dist/components/base/search_box_by_type/search_box_by_type.documentation.js +0 -8
  105. package/dist/components/base/segmented_control/segmented_control.documentation.js +0 -8
  106. package/dist/components/base/skeleton_loader/skeleton_loader.documentation.js +0 -13
  107. package/dist/components/base/skeleton_loading/skeleton_loading.documentation.js +0 -7
  108. package/dist/components/base/sorting/sorting.documentation.js +0 -7
  109. package/dist/components/base/sorting/sorting_item.documentation.js +0 -8
  110. package/dist/components/base/table/table.documentation.js +0 -8
  111. package/dist/components/base/table_lite/table_lite.documentation.js +0 -13
  112. package/dist/components/base/tabs/tabs/tabs.documentation.js +0 -8
  113. package/dist/components/base/toast/toast.documentation.js +0 -8
  114. package/dist/components/base/toggle/toggle.documentation.js +0 -13
  115. package/dist/components/base/token/token.documentation.js +0 -5
  116. package/dist/components/base/token_selector/token_selector.documentation.js +0 -12
  117. package/dist/components/base/tooltip/tooltip.documentation.js +0 -8
  118. package/dist/components/charts/area/area.documentation.js +0 -5
  119. package/dist/components/charts/bar/bar.documentation.js +0 -8
  120. package/dist/components/charts/chart/chart.documentation.js +0 -7
  121. package/dist/components/charts/column/column.documentation.js +0 -5
  122. package/dist/components/charts/discrete_scatter/discrete_scatter.documentation.js +0 -5
  123. package/dist/components/charts/gauge/gauge.documentation.js +0 -12
  124. package/dist/components/charts/heatmap/heatmap.documentation.js +0 -8
  125. package/dist/components/charts/line/line.documentation.js +0 -8
  126. package/dist/components/charts/series_label/series_label.documentation.js +0 -7
  127. package/dist/components/charts/single_stat/single_stat.documentation.js +0 -7
  128. package/dist/components/charts/sparkline/sparkline.documentation.js +0 -8
  129. package/dist/components/charts/stacked_column/stacked_column.documentation.js +0 -8
  130. package/dist/components/charts/tooltip/tooltip.documentation.js +0 -8
  131. package/dist/components/editors/rich_text_editor/rich_text_editor.documentation.js +0 -12
  132. package/dist/components/regions/dashboard_skeleton/dashboard_skeleton.documentation.js +0 -7
  133. package/dist/components/regions/empty_state/empty_state.documentation.js +0 -7
  134. package/dist/components/utilities/animated_number/animated_number.documentation.js +0 -13
  135. package/dist/components/utilities/friendly_wrap/friendly_wrap.documentation.js +0 -7
  136. package/dist/components/utilities/intersection_observer/intersection_observer.documentation.js +0 -12
  137. package/dist/components/utilities/intersperse/intersperse.documentation.js +0 -8
  138. package/dist/components/utilities/sprintf/sprintf.documentation.js +0 -8
  139. package/dist/components/utilities/truncate/truncate.documentation.js +0 -7
  140. package/dist/directives/hover_load/hover_load.documentation.js +0 -13
  141. package/dist/directives/outside/outside.documentation.js +0 -13
  142. package/dist/directives/resize_observer/resize_observer.documentation.js +0 -8
  143. package/dist/directives/safe_html/safe_html.documentation.js +0 -8
  144. package/dist/directives/safe_link/safe_link.documentation.js +0 -8
  145. package/documentation/all_components.js +0 -8
  146. package/documentation/components/component_documentation_generator.vue +0 -321
  147. package/documentation/components/example_display.vue +0 -231
  148. package/documentation/components/example_explorer.vue +0 -63
  149. package/documentation/components_documentation.js +0 -111
  150. package/documentation/index.js +0 -8
  151. package/src/components/base/accordion/accordion.documentation.js +0 -6
  152. package/src/components/base/accordion/accordion_item.documentation.js +0 -5
  153. package/src/components/base/alert/alert.documentation.js +0 -6
  154. package/src/components/base/avatar/avatar.documentation.js +0 -6
  155. package/src/components/base/avatar_labeled/avatar_labeled.documentation.js +0 -6
  156. package/src/components/base/avatar_link/avatar_link.documentation.js +0 -6
  157. package/src/components/base/avatars_inline/avatars_inline.documentation.js +0 -6
  158. package/src/components/base/badge/badge.documentation.js +0 -6
  159. package/src/components/base/banner/banner.documentation.js +0 -6
  160. package/src/components/base/breadcrumb/breadcrumb.documentation.js +0 -6
  161. package/src/components/base/broadcast_message/broadcast_message.documentation.js +0 -6
  162. package/src/components/base/button/button.documentation.js +0 -24
  163. package/src/components/base/button_group/button_group.documentation.js +0 -6
  164. package/src/components/base/card/card.documentation.js +0 -6
  165. package/src/components/base/carousel/carousel.documentation.js +0 -6
  166. package/src/components/base/collapse/collapse.documentation.js +0 -5
  167. package/src/components/base/datepicker/datepicker.documentation.js +0 -5
  168. package/src/components/base/daterange_picker/daterange_picker.documentation.js +0 -6
  169. package/src/components/base/drawer/drawer.documentation.js +0 -6
  170. package/src/components/base/dropdown/dropdown.documentation.js +0 -6
  171. package/src/components/base/dropdown/dropdown_item.documentation.js +0 -5
  172. package/src/components/base/filtered_search/filtered_search.documentation.js +0 -6
  173. package/src/components/base/filtered_search/filtered_search_suggestion.documentation.js +0 -5
  174. package/src/components/base/filtered_search/filtered_search_suggestion_list.documentation.js +0 -5
  175. package/src/components/base/filtered_search/filtered_search_term.documentation.js +0 -5
  176. package/src/components/base/filtered_search/filtered_search_token.documentation.js +0 -5
  177. package/src/components/base/filtered_search/filtered_search_token_segment.documentation.js +0 -5
  178. package/src/components/base/form/form.documentation.js +0 -5
  179. package/src/components/base/form/form_checkbox/form_checkbox.documentation.js +0 -6
  180. package/src/components/base/form/form_checkbox_tree/form_checkbox_tree.documentation.js +0 -5
  181. package/src/components/base/form/form_combobox/form_combobox.documentation.js +0 -6
  182. package/src/components/base/form/form_group/form_group.documentation.js +0 -5
  183. package/src/components/base/form/form_input/form_input.documentation.js +0 -6
  184. package/src/components/base/form/form_input_group/form_input_group.documentation.js +0 -6
  185. package/src/components/base/form/form_radio/form_radio.documentation.js +0 -6
  186. package/src/components/base/form/form_radio_group/form_radio_group.documentation.js +0 -6
  187. package/src/components/base/form/form_select/form_select.documentation.js +0 -6
  188. package/src/components/base/form/form_text/form_text.documentation.js +0 -7
  189. package/src/components/base/form/form_textarea/form_textarea.documentation.js +0 -5
  190. package/src/components/base/form/input_group_text/input_group_text.documentation.js +0 -5
  191. package/src/components/base/icon/icon.documentation.js +0 -6
  192. package/src/components/base/infinite_scroll/examples/index.js +0 -57
  193. package/src/components/base/infinite_scroll/examples/infinite_scroll.all_items.example.vue +0 -25
  194. package/src/components/base/infinite_scroll/examples/infinite_scroll.basic.example.vue +0 -43
  195. package/src/components/base/infinite_scroll/examples/infinite_scroll.finite_total_items.example.vue +0 -44
  196. package/src/components/base/infinite_scroll/examples/infinite_scroll.large_fetched_items.example.vue +0 -43
  197. package/src/components/base/infinite_scroll/examples/infinite_scroll.reverse.example.vue +0 -46
  198. package/src/components/base/infinite_scroll/examples/infinite_scroll.small_fetched_items.example.vue +0 -43
  199. package/src/components/base/infinite_scroll/examples/infinite_scroll.two_way.example.vue +0 -75
  200. package/src/components/base/infinite_scroll/infinite_scroll.documentation.js +0 -6
  201. package/src/components/base/keyset_pagination/keyset_pagination.documentation.js +0 -6
  202. package/src/components/base/label/label.documentation.js +0 -6
  203. package/src/components/base/link/link.documentation.js +0 -5
  204. package/src/components/base/loading_icon/loading_icon.documentation.js +0 -6
  205. package/src/components/base/markdown/markdown.documentation.js +0 -5
  206. package/src/components/base/modal/modal.documentation.js +0 -6
  207. package/src/components/base/nav/nav.documentation.js +0 -5
  208. package/src/components/base/navbar/navbar.documentation.js +0 -5
  209. package/src/components/base/paginated_list/paginated_list.documentation.js +0 -5
  210. package/src/components/base/pagination/pagination.documentation.js +0 -6
  211. package/src/components/base/path/path.documentation.js +0 -6
  212. package/src/components/base/popover/popover.documentation.js +0 -3
  213. package/src/components/base/search_box_by_click/search_box_by_click.documentation.js +0 -6
  214. package/src/components/base/search_box_by_type/search_box_by_type.documentation.js +0 -6
  215. package/src/components/base/segmented_control/segmented_control.documentation.js +0 -6
  216. package/src/components/base/skeleton_loader/skeleton_loader.documentation.js +0 -6
  217. package/src/components/base/skeleton_loading/skeleton_loading.documentation.js +0 -5
  218. package/src/components/base/sorting/sorting.documentation.js +0 -5
  219. package/src/components/base/sorting/sorting_item.documentation.js +0 -6
  220. package/src/components/base/table/table.documentation.js +0 -6
  221. package/src/components/base/table_lite/table_lite.documentation.js +0 -6
  222. package/src/components/base/tabs/tabs/tabs.documentation.js +0 -6
  223. package/src/components/base/toast/toast.documentation.js +0 -6
  224. package/src/components/base/toggle/toggle.documentation.js +0 -6
  225. package/src/components/base/token/token.documentation.js +0 -3
  226. package/src/components/base/token_selector/token_selector.documentation.js +0 -5
  227. package/src/components/base/tooltip/tooltip.documentation.js +0 -6
  228. package/src/components/charts/area/area.documentation.js +0 -3
  229. package/src/components/charts/bar/bar.documentation.js +0 -6
  230. package/src/components/charts/chart/chart.documentation.js +0 -5
  231. package/src/components/charts/column/column.documentation.js +0 -3
  232. package/src/components/charts/discrete_scatter/discrete_scatter.documentation.js +0 -3
  233. package/src/components/charts/gauge/gauge.documentation.js +0 -5
  234. package/src/components/charts/heatmap/heatmap.documentation.js +0 -6
  235. package/src/components/charts/line/line.documentation.js +0 -6
  236. package/src/components/charts/series_label/series_label.documentation.js +0 -5
  237. package/src/components/charts/single_stat/single_stat.documentation.js +0 -5
  238. package/src/components/charts/sparkline/sparkline.documentation.js +0 -6
  239. package/src/components/charts/stacked_column/stacked_column.documentation.js +0 -6
  240. package/src/components/charts/tooltip/tooltip.documentation.js +0 -6
  241. package/src/components/editors/rich_text_editor/rich_text_editor.documentation.js +0 -5
  242. package/src/components/regions/dashboard_skeleton/dashboard_skeleton.documentation.js +0 -5
  243. package/src/components/regions/empty_state/empty_state.documentation.js +0 -5
  244. package/src/components/utilities/animated_number/animated_number.documentation.js +0 -6
  245. package/src/components/utilities/friendly_wrap/friendly_wrap.documentation.js +0 -5
  246. package/src/components/utilities/intersection_observer/intersection_observer.documentation.js +0 -5
  247. package/src/components/utilities/intersperse/intersperse.documentation.js +0 -6
  248. package/src/components/utilities/sprintf/sprintf.documentation.js +0 -6
  249. package/src/components/utilities/truncate/truncate.documentation.js +0 -5
  250. package/src/directives/hover_load/hover_load.documentation.js +0 -6
  251. package/src/directives/outside/outside.documentation.js +0 -6
  252. package/src/directives/resize_observer/resize_observer.documentation.js +0 -6
  253. package/src/directives/safe_html/safe_html.documentation.js +0 -6
  254. package/src/directives/safe_link/safe_link.documentation.js +0 -6
@@ -0,0 +1,104 @@
1
+ import { mount } from '@vue/test-utils';
2
+ import GLIcon from '../../icon/icon.vue';
3
+
4
+ import { ENTER, SPACE } from '../constants';
5
+ import GlListboxItem from './listbox_item.vue';
6
+
7
+ describe('GlListboxItem', () => {
8
+ let wrapper;
9
+
10
+ const buildWrapper = (propsData, slots = {}) => {
11
+ wrapper = mount(GlListboxItem, {
12
+ propsData,
13
+ slots,
14
+ });
15
+ };
16
+ const findItem = () => wrapper.find('[role="option"]');
17
+ const findCheckIcon = () => findItem().findComponent(GLIcon);
18
+
19
+ describe('toggleSelection', () => {
20
+ describe('when selected ', () => {
21
+ beforeEach(() => {
22
+ buildWrapper({ isSelected: true });
23
+ });
24
+
25
+ it('should set `aria-selected` attribute on the list item to `true`', () => {
26
+ expect(findItem().attributes('aria-selected')).toBe('true');
27
+ });
28
+
29
+ it('should display check icon', () => {
30
+ expect(findCheckIcon().classes()).not.toContain('gl-visibility-hidden');
31
+ });
32
+
33
+ it('should emit the `select` event when clicked', async () => {
34
+ await findItem().trigger('click');
35
+ expect(wrapper.emitted('select')[0][0]).toBe(false);
36
+ });
37
+
38
+ it('should emit the `select` event on `ENTER` keydown event', async () => {
39
+ await findItem().trigger('click');
40
+ findItem().trigger('keydown', { code: SPACE });
41
+ expect(wrapper.emitted('select')[0][0]).toBe(false);
42
+ });
43
+
44
+ it('should emit the `select` event on `SPACE` keydown event', async () => {
45
+ await findItem().trigger('click');
46
+ findItem().trigger('keydown', { code: SPACE });
47
+ expect(wrapper.emitted('select')[0][0]).toBe(false);
48
+ });
49
+ });
50
+
51
+ describe('when not selected ', () => {
52
+ beforeEach(() => {
53
+ buildWrapper({ isSelected: false });
54
+ });
55
+
56
+ it('should set `aria-selected` attribute on the list item to `false`', () => {
57
+ expect(findItem().attributes('aria-selected')).toBeUndefined();
58
+ });
59
+
60
+ it('should not display check icon', () => {
61
+ expect(findCheckIcon().classes()).toContain('gl-visibility-hidden');
62
+ });
63
+
64
+ it('should emit the `select` event when clicked', async () => {
65
+ await findItem().trigger('click');
66
+ expect(wrapper.emitted('select')[0][0]).toBe(true);
67
+ });
68
+
69
+ it('should emit the `select` event on `ENTER` keydown event', async () => {
70
+ await findItem().trigger('click');
71
+ findItem().trigger('keydown', { code: ENTER });
72
+ expect(wrapper.emitted('select')[0][0]).toBe(true);
73
+ });
74
+
75
+ it('should emit the `select` event on `SPACE` keydown event', async () => {
76
+ await findItem().trigger('click');
77
+ findItem().trigger('keydown', { code: SPACE });
78
+ expect(wrapper.emitted('select')[0][0]).toBe(true);
79
+ });
80
+ });
81
+ });
82
+
83
+ describe('tabindex', () => {
84
+ it('should set tabindex to `-1` when item is not focused', () => {
85
+ buildWrapper({ isFocused: false });
86
+ expect(wrapper.attributes('tabindex')).toBe('-1');
87
+ });
88
+
89
+ it('should set tabindex to `0` when item is focused', () => {
90
+ buildWrapper({ isFocused: true });
91
+ expect(wrapper.attributes('tabindex')).toBe('0');
92
+ });
93
+ });
94
+
95
+ describe('when default slot content provided', () => {
96
+ const content = 'This is an item';
97
+ const slots = { default: content };
98
+
99
+ it('renders it', () => {
100
+ buildWrapper({}, slots);
101
+ expect(wrapper.text()).toContain(content);
102
+ });
103
+ });
104
+ });
@@ -0,0 +1,59 @@
1
+ <script>
2
+ import GlIcon from '../../icon/icon.vue';
3
+ import { ENTER, SPACE } from '../constants';
4
+ import { stopEvent } from '../../../../utils/utils';
5
+
6
+ export default {
7
+ components: {
8
+ GlIcon,
9
+ },
10
+ props: {
11
+ isSelected: {
12
+ type: Boolean,
13
+ default: false,
14
+ required: false,
15
+ },
16
+ isFocused: {
17
+ type: Boolean,
18
+ default: false,
19
+ required: false,
20
+ },
21
+ },
22
+ methods: {
23
+ toggleSelection() {
24
+ this.$emit('select', !this.isSelected);
25
+ },
26
+ onKeydown(event) {
27
+ const { code } = event;
28
+
29
+ if (code === ENTER || code === SPACE) {
30
+ stopEvent(event);
31
+ this.toggleSelection();
32
+ }
33
+ },
34
+ },
35
+ };
36
+ </script>
37
+
38
+ <template>
39
+ <li
40
+ class="gl-new-dropdown-item"
41
+ role="option"
42
+ :tabindex="isFocused ? 0 : -1"
43
+ :aria-selected="isSelected"
44
+ @click="toggleSelection"
45
+ @keydown="onKeydown"
46
+ >
47
+ <span class="dropdown-item">
48
+ <gl-icon
49
+ name="mobile-issue-close"
50
+ data-testid="dropdown-item-checkbox"
51
+ class="gl-mt-3 gl-align-self-start"
52
+ :class="['gl-new-dropdown-item-check-icon', { 'gl-visibility-hidden': !isSelected }]"
53
+ />
54
+ <span class="gl-new-dropdown-item-text-wrapper">
55
+ <slot></slot>
56
+ </span>
57
+ </span>
58
+ </li>
59
+ </template>
package/src/index.js CHANGED
@@ -54,6 +54,10 @@ export { default as GlDropdownSectionHeader } from './components/base/dropdown/d
54
54
  export { default as GlDropdownDivider } from './components/base/dropdown/dropdown_divider.vue';
55
55
  export { default as GlDropdownText } from './components/base/dropdown/dropdown_text.vue';
56
56
  export { default as GlDropdown } from './components/base/dropdown/dropdown.vue';
57
+ // new components aiming to replace GlDropdown - start
58
+ export { default as GlListbox } from './components/base/new_dropdowns/listbox/listbox.vue';
59
+ export { default as GlListboxItem } from './components/base/new_dropdowns/listbox/listbox_item.vue';
60
+ // new components aiming to replace GlDropdown - end
57
61
  export { default as GlPath } from './components/base/path/path.vue';
58
62
  export { default as GlTable } from './components/base/table/table.vue';
59
63
  export { default as GlBreadcrumb } from './components/base/breadcrumb/breadcrumb.vue';
@@ -2061,6 +2061,14 @@
2061
2061
  color: $white !important;
2062
2062
  }
2063
2063
 
2064
+ .gl-text-contrast-light {
2065
+ color: $white-contrast;
2066
+ }
2067
+
2068
+ .gl-text-contrast-light\! {
2069
+ color: $white-contrast !important;
2070
+ }
2071
+
2064
2072
  .gl-text-body {
2065
2073
  color: $body-color;
2066
2074
  }
@@ -19,6 +19,10 @@
19
19
  color: $white;
20
20
  }
21
21
 
22
+ @mixin gl-text-contrast-light {
23
+ color: $white-contrast;
24
+ }
25
+
22
26
  @mixin gl-text-body {
23
27
  color: $body-color;
24
28
  }
@@ -45,6 +45,7 @@ $black: #000 !default;
45
45
  $black-normal: #333 !default;
46
46
 
47
47
  $white: #fff !default;
48
+ $white-contrast: #fff !default;
48
49
  $white-normal: #f0f0f0 !default;
49
50
  $white-dark: #eaeaea !default;
50
51
  $white-transparent: rgba(255, 255, 255, 0.8) !default;
@@ -122,3 +122,21 @@ export function logWarning(message = '') {
122
122
  console.warn(message); // eslint-disable-line no-console
123
123
  }
124
124
  }
125
+
126
+ /**
127
+ * Stop default event handling and propagation
128
+ */
129
+ export function stopEvent(
130
+ event,
131
+ { preventDefault = true, stopPropagation = true, stopImmediatePropagation = false } = {}
132
+ ) {
133
+ if (preventDefault) {
134
+ event.preventDefault();
135
+ }
136
+ if (stopPropagation) {
137
+ event.stopPropagation();
138
+ }
139
+ if (stopImmediatePropagation) {
140
+ event.stopImmediatePropagation();
141
+ }
142
+ }
@@ -1,4 +1,4 @@
1
- import { isElementFocusable, focusFirstFocusableElement } from './utils';
1
+ import { isElementFocusable, focusFirstFocusableElement, stopEvent } from './utils';
2
2
 
3
3
  describe('isElementFocusable', () => {
4
4
  const myBtn = () => document.querySelector('button');
@@ -77,3 +77,43 @@ describe('focusFirstFocusableElement', () => {
77
77
  expect(document.activeElement).toBe(myInput());
78
78
  });
79
79
  });
80
+
81
+ describe('stopEvent', () => {
82
+ beforeEach(() => {
83
+ jest.clearAllMocks();
84
+ });
85
+
86
+ const event = {
87
+ preventDefault: jest.fn(),
88
+ stopPropagation: jest.fn(),
89
+ stopImmediatePropagation: jest.fn(),
90
+ };
91
+
92
+ it('calls preventDefault and stopPropagation by default', () => {
93
+ stopEvent(event);
94
+
95
+ expect(event.preventDefault).toHaveBeenCalledTimes(1);
96
+ expect(event.stopPropagation).toHaveBeenCalledTimes(1);
97
+ expect(event.stopImmediatePropagation).not.toHaveBeenCalled();
98
+ });
99
+
100
+ it('completely stops the event when stopImmediatePropagation is true', () => {
101
+ stopEvent(event, { stopImmediatePropagation: true });
102
+
103
+ expect(event.preventDefault).toHaveBeenCalledTimes(1);
104
+ expect(event.stopPropagation).toHaveBeenCalledTimes(1);
105
+ expect(event.stopImmediatePropagation).toHaveBeenCalledTimes(1);
106
+ });
107
+
108
+ it('calls event stop methods set to true', () => {
109
+ stopEvent(event, {
110
+ preventDefault: false,
111
+ stopPropagation: false,
112
+ stopImmediatePropagation: true,
113
+ });
114
+
115
+ expect(event.preventDefault).not.toHaveBeenCalled();
116
+ expect(event.stopPropagation).not.toHaveBeenCalled();
117
+ expect(event.stopImmediatePropagation).toHaveBeenCalledTimes(1);
118
+ });
119
+ });
@@ -1,8 +0,0 @@
1
- var description = "Accordions are used to group similar content and hide or show it depending on user needs or\npreferences. Accordions give users more granular control over the interface and help digest content\nin stages, rather than all at once.\n";
2
-
3
- var accordion_documentation = {
4
- followsDesignSystem: true,
5
- description
6
- };
7
-
8
- export default accordion_documentation;
@@ -1,7 +0,0 @@
1
- var description = "## Usage\n\nUse `GlAccordionItem` to place the accordion item within your accordion.\n";
2
-
3
- var accordion_item_documentation = {
4
- description
5
- };
6
-
7
- export default accordion_item_documentation;
@@ -1,13 +0,0 @@
1
- var alert = "Alerts allow the application to pass along relevant system information to the\nuser without impeding their journey. Alerts are system generated and may or may\nnot be derived by a user’s action.\n\n## Dismissible alerts\n\nAlerts don't handle their own visibility, so it's the parent component's\nresponsbility to listen for the `dismiss` event and hide the alert in some way.\nFor example:\n\n```html\n<script>\n ...\n computed: {\n shouldShowAlert() {\n return !this.isAlertDismissed && this.someOtherCondition();\n },\n },\n ...\n</script>\n\n<template>\n ...\n <gl-alert v-if=\"shouldShowAlert\" @dismiss=\"isAlertDismissed = true\">\n An important message\n </gl-alert>\n ...\n</template>\n```\n\n## Sticky alerts\n\nAny alert can use `position: sticky`, however it should be limited to critical alerts where keeping\nthe alert visually in context is necessary or when alerts are injected into a page and might\notherwise go unnoticed.\n";
2
-
3
- var description = /*#__PURE__*/Object.freeze({
4
- __proto__: null,
5
- 'default': alert
6
- });
7
-
8
- var alert_documentation = {
9
- description,
10
- followsDesignSystem: true
11
- };
12
-
13
- export default alert_documentation;
@@ -1,8 +0,0 @@
1
- var description = "Avatars are used to represent a unique entity, be it a person, a group, or a project.\n";
2
-
3
- var avatar_documentation = {
4
- followsDesignSystem: true,
5
- description
6
- };
7
-
8
- export default avatar_documentation;
@@ -1,8 +0,0 @@
1
- var description = "## Usage\n\nAvatars may also be adjacent to a text alternative, such as a user or project name. In these cases,\na null `alt` text should be used so that they can be ignored by assistive technologies.\n\nUse the `avatar-labeled` component in those scenarios. It will set a null `alt` text by default.\nIt allows to display a `label` and/or a `sub-label` next to the avatar image. It accepts the same\nproperties as the avatar component to modify the avatar’s shape and size.\n\n## Using the component\n\n```js\n<gl-avatar-labeled\n :shape=\"shape\"\n :size=\"size\"\n :src=\"src\"\n :label=\"label\"\n :sub-label=\"subLabel\"\n/>\n```\n";
2
-
3
- var avatar_labeled_documentation = {
4
- followsDesignSystem: true,
5
- description
6
- };
7
-
8
- export default avatar_labeled_documentation;
@@ -1,8 +0,0 @@
1
- var description = "`<gl-avatar-link>` decorates `<gl-avatar>` with hyperlink functionality. It accepts the same\nproperties as the `<gl-link>` component and it works in the same way too. The main purpose of this\ncomponent is to apply visual enhancements that makes evident that the user can interact with the\navatar.\n\n## Using the component\n\nWhen wrapping an `<gl-avatar>` component, `<gl-avatar-link>` darkens\nthe border that surrounds the avatar image or fallback text when hovering over it.\n\n```vue\n<gl-avatar-link target=\"blank\" href=\"https://gitlab.com/gitlab-org/gitlab\">\n <gl-avatar\n :size=\"32\"\n :src=\"avatarUrl\"\n />\n</gl-avatar-link>\n```\n\nWhen wrapping an `<avatar-labeled>` component, `<avatar-link>` underlines\nthe label and sub-label text when hovering over the avatar. It also applies the\nsame effects described in the first example.\n\n```vue\n<gl-avatar-link target=\"blank\" href=\"https://gitlab.com/gitlab-org/gitlab\">\n <gl-avatar-labeled\n :size=\"32\"\n entity-name=\"GitLab\"\n label=\"GitLab User\"\n sub-label=\"@gitlab\"\n />\n</gl-avatar-link>\n```\n";
2
-
3
- var avatar_link_documentation = {
4
- followsDesignSystem: true,
5
- description
6
- };
7
-
8
- export default avatar_link_documentation;
@@ -1,13 +0,0 @@
1
- var avatars_inline = "Use `<avatars-inline />` to display multiple avatars organized in a single row.\n\n### Basic usage\n\nThe `avatars` property accepts an array of objects that contains the avatar properties. By default,\n`<avatars-inline />` expects each object contained in the array to have the same shape as the\nproperties of the `<avatar />` component. You can customize the display of each avatar by\noverriding the default slot:\n\n```html\n<gl-avatars-inline :avatars=\"avatars\">\n <template #avatar=\"{ avatar }\">\n <gl-avatar-link v-gl-tooltip target=\"blank\" :href=\"avatar.href\" :title=\"avatar.tooltip\">\n <gl-avatar :src=\"avatar.src\" :size=\"32\" />\n </gl-avatar-link>\n </template>\n</gl-avatars-inline>\n```\n\nIn the example above, the avatars displayed inside `<avatars-inline />` are links pointing to a URL\nstored in each avatar object. Each avatar also displays a tooltip. If you override\n`<inline-avatars />` default display, you can pass an array of objects with any desired shape to\nthe `avatars` property.\n\n### Collapsing\n\nWhen the `collapse` property value is `true` and the `maxVisible` property value is a number less\nthan the length of the `avatars` property array, `<avatars-inline>` will hide the overflown avatars\nand display a badge instead.\n\n### Badge description in screen readers\n\nThe `badgeSrOnlyText` property provides a meaningful description of the badge that appears\nwhen avatars are collapsed for screen reader users.\n\n### Supported sizes\n\n`<avatars-inline>` only supports avatars with `24` or `32` size.\n";
2
-
3
- var description = /*#__PURE__*/Object.freeze({
4
- __proto__: null,
5
- 'default': avatars_inline
6
- });
7
-
8
- var avatars_inline_documentation = {
9
- followsDesignSystem: true,
10
- description
11
- };
12
-
13
- export default avatars_inline_documentation;
@@ -1,8 +0,0 @@
1
- var description = "Badges highlight metadata of objects, the kind of information that always needs\nsome context and isn’t useful on its own. For example, they can be used to\nindicate an issue’s status, a member’s role, or if a branch is protected.\n\n## Usage\n\n```html\n<gl-badge>Hello, world!</gl-badge>\n```\n\n> Note: Native support for icons in badges will be added in a future version.\n\n### Using icon-only badges\n\nWhen a badge only has an icon and no slot content, be sure to set the `aria-label` attribute of the\nbadge for best accessibility.\n\n```html\n<!-- bad -->\n<gl-badge icon=\"eye\" />\n\n<!-- good -->\n<gl-badge icon=\"eye\" aria-label=\"Mark as confidential\" />\n```\n\n## Edge cases\n\nWhile this component is based on\n[`BBadge`](https://bootstrap-vue.org/docs/components/badge) from\n`bootstrap-vue`, it is not a drop-in replacement. Specifically, this component:\n\n- Has a different set of valid `variant`s. See the examples or props\n documentation for those values.\n- Always sets the `pill` prop of the underlying `BBadge` to `true`. Any passed\n in `pill` prop value is ignored.\n- Does _not_ scale itself to match the size of its immediate parent, like\n `BBadge` does.\n";
2
-
3
- var badge_documentation = {
4
- description,
5
- followsDesignSystem: true
6
- };
7
-
8
- export default badge_documentation;
@@ -1,8 +0,0 @@
1
- var description = "## Dismiss\n\nUsers are able to permanently dismiss banners by default.\nBanners may also be dismissed temporarily, depending on the use case.\n\n### Permanent dismissal\n\nThe dismiss action is always represented by the `Close` icon and anchored\nto the top right of the banner.\n\nBanner dismissal should work as follows:\n\n* Banner dismissal must be associated with the user in the system database.\n Dismissal must persist, even across version upgrades and clients.\n* Banners do not reappear by default. In rare circumstances, you may present the\n banner again to a user after some time has passed.\n* Banners should only be shown to users who are logged in.\n\n**Implementation Notes:**\n\n* The dismissal of the banner is achieved using the `UserCallout` model on the backend and the\n `PersistentUserCallout` JS file on the frontend. If both parameters are implemented correctly, the\n banner will adhere to the dismissal guidelines above.\n\n### Temporary dismissal\n\nTo introduce temporary dismissal, include a secondary or tertiary button placed alongside\nthe primary action button. Follow the [button](https://design.gitlab.com/components/button#alignment)\nalignment and order guidelines.\n\nTemporary dismissals should work as follows:\n\n* Banners dismissed temporarily will reappear after **7 days**.\n* After a banner is dismissed temporarily, use a [toast](?path=/story/base-toast--default) message\n to let the user know they will see the banner again in 7 days.\n";
2
-
3
- var banner_documentation = {
4
- followsDesignSystem: true,
5
- description
6
- };
7
-
8
- export default banner_documentation;
@@ -1,8 +0,0 @@
1
- var description = "## Usage\n\nThis component provides two `<slot>` elements for customization. The first is a `<slot #avatar>`\nso an avatar can appear before the first breadcrumb. The second is a `<slot #separator>` to\ncustomize the icon that appears between each breadcrumb.\n\n**note:** the component supports passing the property `to` in the list items to enable navigation\nthrough `vue-router`\n\n### Example\n\nYou can use any kind of separator you want in the slot, like below, which uses `<svg>`\nto draw a `/`\n\n```html\n<gl-breadcrumb :items=\"items\">\n <template #avatar>\n <img \n alt=\"\"\n class=\"gl-breadcrumb-avatar-tile\"\n src=\"https://assets.gitlab-static.net/uploads/-/system/group/avatar/9970/logo-extra-whitespace.png?width=16\"\n width=\"16\"\n height=\"16\"\n />\n </template>\n <template #separator>\n <svg height=\"16\">\n <line x1=\"100%\" y1=\"0\" x2=\"0\" y2=\"100%\" stroke=\"gray\" />\n </svg>\n </template>\n</gl-breadcrumb>\n```\n";
2
-
3
- var breadcrumb_documentation = {
4
- followsDesignSystem: true,
5
- description
6
- };
7
-
8
- export default breadcrumb_documentation;
@@ -1,8 +0,0 @@
1
- var description = "Broadcast messages provide an efficient and prominent way to deliver critical messages at the\ninstance level to all users. For example, a broadcast message can be used when an admin wants to\nannounce that their platform will experience downtime during a specific period.\n\nIn comparison with an alert, broadcast messages are created by an admin and not triggered by the\nsystem.\n\nPlease refer to [Pajamas' documentation](https://design.gitlab.com/components/broadcast-message)\nfor more information on when to use this component.\n\n## Dismiss a broadcast message\n\nThe `GlBroadcastMessage` component deals with users dismissal the same way `GlAlert` does, meaning\nit does not handle its own visibility but emits a `dismiss` event that the parent component should\nlisten to in order to hide the message. Example:\n\n```html\n<template>\n ...\n <gl-broadcast-message v-if=\"!dismissed\" @dismiss=\"dismissed = true\">\n An important message\n </gl-broadcast-message>\n ...\n</template>\n```\n";
2
-
3
- var broadcast_message_documentation = {
4
- followsDesignSystem: false,
5
- description
6
- };
7
-
8
- export default broadcast_message_documentation;
@@ -1,24 +0,0 @@
1
- var description = "Buttons execute an action, either in the background or foreground of an experience. Different button\ncategories help guide users through certain actions. Buttons express what action will occur when the\nuser clicks or touches it either by text, icon, or both. Additional meaning can be derived from the\nbutton variant.\n\n## Button link\n\nA button link is a link that is styled to look like a button, semantically speaking it's a `<a>` tag\nwith the necessary classes added to make it look like a button, it shares the same functionality as\n[`<gl-link>`]\n\n> Note: Setting a `target` attribute without a `href` attribute, will not create any side effects.\n> Without the presence of a `href` attribute, this component will render a `<button>`.\n\n[`<gl-link>`]: ./?path=/story/base-link--default-link\n\n## Icon-only button\n\nIcon-only buttons must have an accessible name.\nYou can provide one with the `aria-label` attribute, which is read out by screen readers.\n\n```html\n<gl-button icon=\"close\" aria-label=\"Close\" />\n```\n\n## Label button\n\nA label button renders a non-interactive `span` styled as a button. This can be especially useful\nwhen used in a button group to render text-only labels along with actionable buttons. To improve\naccessibility, and when applicable, consider using [`aria-describedby`] to establish a\nrelationship between the label button and the associated button.\n\n[`aria-describedby`]: https://developer.mozilla.org/en-US/docs/Web/Accessibility/ARIA/ARIA_Techniques/Using_the_aria-describedby_attribute\n\n## Security\n\nThis component implements a few security measures to make it as safe as possible by default.\nSee [SafeLinkDirective docs] for more details.\n\n### Linking to an unsafe URL\n\nIf you're trying to link to a location considered unsafe by the `SafeLink` directive (when rendering\na download link with a [Data URL] for example), you'll need to bypass the `href` attribute's\nsanitization. This component exposes the `is-unsafe-link` prop for that purpose.\n\n> **Warning:** Only disable URL sanitization when absolutely necessary.\n\n```html\n<gl-button\n is-unsafe-link\n download=\"file.txt\"\n href=\"data:text/plain;charset=utf-8,GitLab%20is%20awesome\">Download</gl-button>\n```\n\n[SafeLinkDirective docs]: https://gitlab-org.gitlab.io/gitlab-ui/?path=/docs/directives-safe-link-directive--default\n[Data URL]: https://developer.mozilla.org/en-US/docs/Web/HTTP/Basics_of_HTTP/Data_URIs\n\n## vue-bootstrap component\n\nThis component uses [`BButton`](https://bootstrap-vue.org/docs/components/button) from vue-bootstrap\ninternally. So please take a look also there at their extensive documentation.\n";
2
-
3
- var button_documentation = {
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
- event: 'click',
20
- description: 'Emitted when clicked on button'
21
- }]
22
- };
23
-
24
- export default button_documentation;
@@ -1,8 +0,0 @@
1
- var description = "Button groups are an easy way to group a series of buttons together.\n\n## vue-bootstrap component\n\nThis component uses [`BButtonGroup`](https://bootstrap-vue.org/docs/components/button-group) from vue-bootstrap\ninternally. So please take a look also there at their extensive documentation.\n";
2
-
3
- var button_group_documentation = {
4
- description,
5
- followsDesignSystem: true
6
- };
7
-
8
- export default button_group_documentation;
@@ -1,13 +0,0 @@
1
- var card = "Cards are a flexible component used to display content and actions in a variety of contexts.\nThey are generally restricted to a single topic and it should be easy for users to scan relevant and\nactionable information. Content, such as images and text, should be positioned within them in a\nmanner that demonstrates their intended hierarchy.\n";
2
-
3
- var description = /*#__PURE__*/Object.freeze({
4
- __proto__: null,
5
- 'default': card
6
- });
7
-
8
- var card_documentation = {
9
- followsDesignSystem: true,
10
- description
11
- };
12
-
13
- export default card_documentation;
@@ -1,8 +0,0 @@
1
- var description = "The carousel is a slideshow for cycling through a series of content, built with CSS 3D\ntransforms. It works with a series of images, text, or custom markup. It also includes support\nfor previous/next controls and indicators.\n";
2
-
3
- var carousel_documentation = {
4
- description,
5
- bootstrapComponent: 'b-carousel'
6
- };
7
-
8
- export default carousel_documentation;
@@ -1,7 +0,0 @@
1
- var description = "Collapse is used to keep pages focused on the overview of what the user can do. Details and\nadditional actions are hidden in the fold, and can be opened if the user wants to interact with\nthose elements.\n";
2
-
3
- var collapse_documentation = {
4
- description
5
- };
6
-
7
- export default collapse_documentation;
@@ -1,7 +0,0 @@
1
- var description = "Date picker allows users to choose and input a date by manually typing the date into the input field\nor by using a calendar-like dropdown.\n\n### Warning\n\nBe careful when binding a date value using `value` prop. `value` is a watched property and Date\npicker will emit `input` event on _initial load_. Alternatively, use `defaultDate` to set the\ninitial date then receive updated date values through `input` events.\n";
2
-
3
- var datepicker_documentation = {
4
- description
5
- };
6
-
7
- export default datepicker_documentation;
@@ -1,8 +0,0 @@
1
- var description = "## Usage\n\nDaterange picker allows users to choose a date range by manually typing the start/end date\ninto the input fields or by using a calendar-like dropdown.\n\nA `maxDateRange` can be specified in order to limit the maximum number of days the component\nwill allow to be selected i.e. if the start date is `2020-08-01` and `maxDateRange` is set to `10`,\nthe highest selectable end date would be `2020-08-11`. This value will be offset by `1` if\n`sameDaySelection` is set to `true`. A `defaultMaxDate` will need to be\nprovided when making use of the `maxDateRange`.\n\nBy default, the component does not allow selection of the same start and end date.\nIn a scenario where this is required, the `sameDaySelection` property can be configured.\nThis is specifically useful when a single day selection is being defined as `2020-01-01 00:00:00`\nto `2020-01-01 23:59:59` instead of `2020-01-01 00:00:00` to `2020-01-02 00:00:00`.\n\nWhen `maxDateRange` is set it's a good idea to set the `tooltip` specifying the date range limit\nand to indicate the number of days currently selected using the default slot. For example:\n\n```vue\n<template #default=\"{ daysSelected }\">\n <span v-if=\"daysSelected > -1\">{{ daysSelected }} days selected</span>\n <span v-else>No days selected</span>\n</template>\n```\n\nThe `daysSelected` slot prop is the effective date range, thus the value is increased by one when\n`sameDaySelection` is set to `true`. When no date range has been selected the value is `-1`.\n\n### Note\n\nIf specifying a maxDateRange, it is good practice to include a date range indicator and toolip.\n";
2
-
3
- var daterange_picker_documentation = {
4
- followsDesignSystem: true,
5
- description
6
- };
7
-
8
- export default daterange_picker_documentation;
@@ -1,8 +0,0 @@
1
- var description = "The drawer is used to show more information about a certain resource in the UI and potentially\nhandle actions on the information.\n\n### By default\n\n```html\n<gl-drawer :open=\"open\" @close=\"close\">\n <template #header>Your Title</template>\n <template>\n ...children\n </template>\n</gl-drawer>\n```\n\n- `v-bind:open` will be a boolean you will pass to `gl-drawer` and `@close` is a listener that will\nbe a function that will toggle open to `false`.\n";
2
-
3
- var drawer_documentation = {
4
- followsDesignSystem: true,
5
- description
6
- };
7
-
8
- export default drawer_documentation;
@@ -1,8 +0,0 @@
1
- var description = "The dropdown component offers a user multiple items or actions to choose from which are initially\ncollapsed behind a button.\n\n### Icon-only dropdown\n\nIcon-only dropdowns must have an accessible name.\nYou can provide this with the combination of `text` and `text-sr-only` props.\n\nOptionally, you can use `no-caret` to remove the caret and `category=\"tertiary\"` to remove the border.\n\n```html\n<gl-dropdown\n icon=\"ellipsis_v\"\n text=\"More actions\"\n :text-sr-only=\"true\"\n category=\"tertiary\"\n no-caret\n>\n```\n\n### Button Content\n\nThere are 3 ways to set the dropdown button's content.\n\n1. Use the `text` attribute. This will display the text with the loading spinner (shown with the\n`loading` attribute), icon (if provided by the `icon` attribute), and dropdown caret:\n\n ```html\n <gl-dropdown text=\"Button text\">\n ```\n\n1. Use the `button-text` template. This allows custom content for the button's text, but keeps the\nloading spinner, icon, and dropdown caret:\n\n ```html\n <gl-dropdown>\n <template #button-text>\n <!-- Loading spinner shown here -->\n <!-- Icon shown here -->\n Custom <strong>Content</strong> with <em>HTML</em> via Slot\n <gl-truncate position=\"middle\" text=\"Truncated button text\"/>\n <!-- Dropdown arrow shown here -->\n </template>\n </gl-dropdown>\n ```\n\n1. Use the `button-content` template. This will replace everything in the button with the template:\n\n ```html\n <gl-dropdown>\n <template #button-content>\n Custom <strong>Content</strong> with <em>HTML</em> via Slot\n </template>\n </gl-dropdown>\n ```\n\n### GlDropdownForm\n\nUnlike `b-dropdown-form`, we do _not_ add any additional padding with the `gl-dropdown-form` component.\nThis is to prevent double padding with `gl-dropdown-item` and similar components, so in most cases\nshouldn't be needed. To add padding, either add a padding utility class to your form, or an inner\nelement with some padding.\n";
2
-
3
- var dropdown_documentation = {
4
- description,
5
- followsDesignSystem: false
6
- };
7
-
8
- export default dropdown_documentation;
@@ -1,7 +0,0 @@
1
- var description = "The dropdown item component is meant to be used for clickable entries inside a dropdown component.\nIf you provide the `href` attribute, it renders a link instead of a button.\n";
2
-
3
- var dropdown_item_documentation = {
4
- description
5
- };
6
-
7
- export default dropdown_item_documentation;
@@ -1,13 +0,0 @@
1
- var filtered_search = "The filtered search component is responsible for managing search with possible filters.\n\n## Usage\n\nEach filter option (named token) requires a separate Vue component. `GlFilteredSearchToken` is an\nexample of such a token.\n\nPrepare array of available token configurations with the following fields:\n\n- `type`: unique identifier of token type\n- `title`: human-readable title of the token\n- `icon`: token icon\n- `token`: (optional) the token Vue component to use (e.g. `AuthorToken`)\n- `dataType`: (optional) identifier of type (for example \"user\") for this filter. Tokens\n of the same type could be switched without losing their values\n- `unique`: (optional) indicate this token could appear only once in the filter\n- `disabled`: (optional) indicate this token should be hidden from the dropdown\n- `operators`: (optional) an array of selectable operators.\n Each array item is an object that must contain `value` and `description`, and optionally `default`\n (e.g. `{ value: '=', description: 'is', default: 'true' }`)\n- `multiSelect`: (optional) when `true`, the suggestions list becomes multi-select instead of single-select.\n It is discouraged to use this together with `unique`, as `unique` is intended for single-select.\n- `options`: (optional) an array of options which the user can pick after the operator has been selected.\n The option object can have the following properties defined: `value`, `icon`, `text`, and `default`\n all of which are expected be of type `string`. If the `default` is omitted, the `value` of the first\n option will be displayed as a suggestion\n- any additional fields required to configure your component\n\nEach token for filtered search is a Vue component with the following props:\n\n- `value`: an object with a `data` property containing the current value, and optionally an\n`operator` value containing the operator value\n- `active`: indicates if the token is currently active. It's the token's responsibility\n to render proper control for editing (for example input).\n- `current-value`: current tokens of the filtered search.\n- `index`: current token position in the filtered search.\n- `config`: additional configuration, supplied in filtered search config for this token.\n\nThe token should emit the following events:\n\n- `activate`: when the token requests activation (for example, when being clicked).\n- `deactivate`: when token requests deactivation (for example due to losing blur on input).\n- `destroy`: when token requests self-destruction (for instance for clicking \"X\" sign).\n- `replace`: token requests its replacement with another token.\n- `split`: token requests adding string values after the current token.\n- `complete`: token indicates its editing is completed.\n\n## Examples\n\nDefine a list of available tokens:\n\n```js\nconst availableTokens = [\n { type: 'static', icon: 'label', title: 'static:token', token: staticToken },\n { type: 'dynamic', icon: 'rocket', title: 'dynamic:~token', token: dynamicToken },\n];\n```\n\nPass the list of tokens to the search component. Optionally, you can use `v-model` to receive\nrealtime updates:\n\n```html\n\n<gl-filtered-search :available-tokens=\"tokens\" v-model=\"value\" />\n```\n";
2
-
3
- var description = /*#__PURE__*/Object.freeze({
4
- __proto__: null,
5
- 'default': filtered_search
6
- });
7
-
8
- var filtered_search_documentation = {
9
- description,
10
- followsDesignSystem: true
11
- };
12
-
13
- export default filtered_search_documentation;
@@ -1,7 +0,0 @@
1
- var description = "The filtered search suggestion component is a wrapper around `GlDropdownItem`, which registers\nsuggestions in a top-level suggestion list:\n\n```html\n<gl-filtered-search-suggestion-list>\n <gl-filtered-search-suggestion value=\"foo\">Example suggestion</gl-filtered-search-suggestion>\n <gl-filtered-search-suggestion value=\"bar\">Example suggestion 2</gl-filtered-search-suggestion>\n</gl-filtered-search-suggestion-list>\n```\n";
2
-
3
- var filtered_search_suggestion_documentation = {
4
- description
5
- };
6
-
7
- export default filtered_search_suggestion_documentation;
@@ -1,7 +0,0 @@
1
- var description = "The filtered search suggestion list component is responsible for managing underlying suggestion instances.\nYou obtain the ref for this component and manage suggestion selection via the component public API:\n\n- `getValue()` - Retrieves the current selected suggestion.\n- `nextItem()` - Selects the next suggestion. If last suggestion was selected, selection is cleared.\n- `prevItem()` - Selects the previous suggestion. If first suggestion was selected, selection is cleared.\n\n```html\n<gl-filtered-search-suggestion-list ref=\"suggestions\">\n <gl-filtered-search-suggestion value=\"foo\">Example suggestion</gl-filtered-search-suggestion>\n <gl-filtered-search-suggestion value=\"bar\">Example suggestion 2</gl-filtered-search-suggestion>\n</gl-filtered-search-suggestion-list>\n```\n";
2
-
3
- var filtered_search_suggestion_list_documentation = {
4
- description
5
- };
6
-
7
- export default filtered_search_suggestion_list_documentation;
@@ -1,12 +0,0 @@
1
- var filtered_search_term = "The filtered search term is a component for managing \"free input\" in the filtered search component.\nIt is responsible for autocompleting available tokens and \"converting\" to a relevant\ncomponent when an autocomplete item is selected.\n\n## Usage\n\nThis component is internal and is not intended to be used by `@gitlab/ui` users.\n";
2
-
3
- var description = /*#__PURE__*/Object.freeze({
4
- __proto__: null,
5
- 'default': filtered_search_term
6
- });
7
-
8
- var filtered_search_term_documentation = {
9
- description
10
- };
11
-
12
- export default filtered_search_term_documentation;
@@ -1,12 +0,0 @@
1
- var filtered_search_token = "Filtered search token is a helper component, intended to\nsimplify the creation of filters tokens which consist of a title, operators\nand an editable value with autocomplete. This component abstracts token management\nlogic and allows you to focus on implementing autocomplete or view logic.\n\nThis component is not intended to be used outside of the `GlFilteredSearch` component.\n\n## Usage\n\nMake sure to pass `$listeners` to `gl-filtered-search-token`, or route events properly:\n\n```html\n<gl-filtered-search-token\n title=\"Confidential\"\n :active=\"active\"\n :value=\"value\"\n v-on=\"$listeners\"\n>\n <template #suggestions>\n <gl-filtered-search-suggestion value=\"Yes\"><gl-icon name=\"eye-slash\" :size=\"16\"/> Yes</gl-filtered-search-suggestion>\n <gl-filtered-search-suggestion value=\"No\"><gl-icon name=\"eye\" :size=\"16\"/> No</gl-filtered-search-suggestion>\n </template>\n</gl-filtered-search-token>\n```\n";
2
-
3
- var description = /*#__PURE__*/Object.freeze({
4
- __proto__: null,
5
- 'default': filtered_search_token
6
- });
7
-
8
- var filtered_search_token_documentation = {
9
- description
10
- };
11
-
12
- export default filtered_search_token_documentation;
@@ -1,12 +0,0 @@
1
- var filtered_search_token_segment = "The filtered search token segment is a component for managing token input either via free typing\nor by selecting item through dropdown list\n\n## Usage\n\nThis component is internal and is not intended to be used by `@gitlab/ui` users.\n\n## Internet Explorer 11\n\nThis component uses [`String.prototype.startsWith()`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/startsWith)\nand [`String.prototype.endsWith()`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/endsWith)\nunder the hood. Make sure those methods are polyfilled if you plan on using the component on IE11.\n\n> NOTE: These methods are already polyfilled in GitLab: [`app/assets/javascripts/commons/polyfills.js#L15-16`](https://gitlab.com/gitlab-org/gitlab/blob/dc60dee6ed6234dda9f032195577cd8fad9646d8/app/assets/javascripts/commons/polyfills.js#L15-16)\n";
2
-
3
- var description = /*#__PURE__*/Object.freeze({
4
- __proto__: null,
5
- 'default': filtered_search_token_segment
6
- });
7
-
8
- var filtered_search_token_segment_documentation = {
9
- description
10
- };
11
-
12
- export default filtered_search_token_segment_documentation;
@@ -1,7 +0,0 @@
1
- var description = "A wrapper element for `gl-form-*` input elements. Supports `@submit` and `@reset` events, as well as\ncontrolling validation settings for form inputs.\n";
2
-
3
- var form_documentation = {
4
- description
5
- };
6
-
7
- export default form_documentation;