@gitlab/ui 49.0.1 → 49.0.3
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 +14 -0
- package/dist/components/base/accordion/accordion.js +2 -8
- package/dist/components/base/accordion/accordion_item.js +0 -14
- package/dist/components/base/alert/alert.js +4 -22
- package/dist/components/base/avatar/avatar.js +0 -7
- package/dist/components/base/avatar_labeled/avatar_labeled.js +0 -2
- package/dist/components/base/avatars_inline/avatars_inline.js +2 -10
- package/dist/components/base/badge/badge.js +0 -8
- package/dist/components/base/banner/banner.js +0 -10
- package/dist/components/base/breadcrumb/breadcrumb.js +0 -12
- package/dist/components/base/breadcrumb/breadcrumb_item.js +0 -2
- package/dist/components/base/broadcast_message/broadcast_message.js +0 -3
- package/dist/components/base/button/button.js +0 -11
- package/dist/components/base/card/card.js +1 -2
- package/dist/components/base/datepicker/datepicker.js +7 -42
- package/dist/components/base/daterange_picker/daterange_picker.js +0 -23
- package/dist/components/base/drawer/drawer.js +0 -13
- package/dist/components/base/dropdown/dropdown.js +3 -17
- package/dist/components/base/dropdown/dropdown_item.js +2 -8
- package/dist/components/base/filtered_search/common_story_options.js +1 -2
- package/dist/components/base/filtered_search/filtered_search.js +9 -61
- package/dist/components/base/filtered_search/filtered_search_suggestion.js +0 -6
- package/dist/components/base/filtered_search/filtered_search_suggestion_list.js +0 -16
- package/dist/components/base/filtered_search/filtered_search_term.js +0 -9
- package/dist/components/base/filtered_search/filtered_search_token.js +10 -49
- package/dist/components/base/filtered_search/filtered_search_token_segment.js +3 -56
- package/dist/components/base/filtered_search/filtered_search_utils.js +7 -24
- package/dist/components/base/form/form_checkbox/form_checkbox.js +0 -2
- package/dist/components/base/form/form_checkbox_tree/checkbox_tree_node.js +0 -4
- package/dist/components/base/form/form_checkbox_tree/form_checkbox_tree.js +0 -10
- package/dist/components/base/form/form_checkbox_tree/models/node.js +1 -10
- package/dist/components/base/form/form_checkbox_tree/models/tree.js +16 -37
- package/dist/components/base/form/form_combobox/form_combobox.js +2 -36
- package/dist/components/base/form/form_group/form_group.js +2 -7
- package/dist/components/base/form/form_input/form_input.js +2 -8
- package/dist/components/base/form/form_input_group/form_input_group.js +0 -5
- package/dist/components/base/form/form_input_group/form_input_group_mixin.js +0 -8
- package/dist/components/base/form/form_radio_group/form_radio_group.js +0 -2
- package/dist/components/base/form/form_select/form_select.js +0 -3
- package/dist/components/base/form/form_textarea/form_textarea.js +2 -7
- package/dist/components/base/icon/icon.js +4 -14
- package/dist/components/base/infinite_scroll/infinite_scroll.js +7 -21
- package/dist/components/base/keyset_pagination/keyset_pagination.js +0 -9
- package/dist/components/base/label/label.js +0 -12
- package/dist/components/base/loading_icon/loading_icon.js +7 -10
- package/dist/components/base/markdown/markdown.js +1 -0
- package/dist/components/base/modal/modal.js +7 -27
- package/dist/components/base/new_dropdowns/base_dropdown/base_dropdown.js +0 -25
- package/dist/components/base/new_dropdowns/constants.js +4 -2
- package/dist/components/base/new_dropdowns/listbox/listbox.js +0 -63
- package/dist/components/base/new_dropdowns/listbox/listbox_group.js +0 -2
- package/dist/components/base/new_dropdowns/listbox/listbox_item.js +0 -5
- package/dist/components/base/new_dropdowns/listbox/utils.js +0 -7
- package/dist/components/base/paginated_list/paginated_list.js +0 -15
- package/dist/components/base/pagination/pagination.js +14 -72
- package/dist/components/base/path/path.js +0 -29
- package/dist/components/base/popover/popover.js +0 -5
- package/dist/components/base/search_box_by_click/search_box_by_click.js +1 -26
- package/dist/components/base/search_box_by_type/search_box_by_type.js +2 -12
- package/dist/components/base/segmented_control/segmented_control.js +0 -10
- package/dist/components/base/skeleton_loader/skeleton_loader.js +0 -19
- package/dist/components/base/skeleton_loading/skeleton_loading.js +0 -3
- package/dist/components/base/sorting/sorting.js +1 -9
- package/dist/components/base/sorting/sorting_item.js +4 -6
- package/dist/components/base/table/table.js +0 -4
- package/dist/components/base/tabs/tab/tab.js +2 -6
- package/dist/components/base/tabs/tabs/scrollable_tabs.js +0 -21
- package/dist/components/base/tabs/tabs/tabs.js +8 -33
- package/dist/components/base/toast/toast.js +4 -15
- package/dist/components/base/toggle/toggle.js +0 -18
- package/dist/components/base/token/token.js +0 -4
- package/dist/components/base/token_selector/token_container.js +0 -24
- package/dist/components/base/token_selector/token_selector.js +10 -61
- package/dist/components/base/token_selector/token_selector_dropdown.js +4 -32
- package/dist/components/charts/area/area.js +8 -32
- package/dist/components/charts/bar/bar.js +7 -19
- package/dist/components/charts/chart/chart.js +1 -22
- package/dist/components/charts/column/column.js +8 -18
- package/dist/components/charts/discrete_scatter/discrete_scatter.js +2 -13
- package/dist/components/charts/gauge/gauge.js +0 -15
- package/dist/components/charts/heatmap/heatmap.js +3 -16
- package/dist/components/charts/legend/legend.js +2 -24
- package/dist/components/charts/line/line.js +8 -34
- package/dist/components/charts/series_label/series_label.js +0 -12
- package/dist/components/charts/single_stat/single_stat.js +0 -8
- package/dist/components/charts/sparkline/sparkline.js +1 -16
- package/dist/components/charts/stacked_column/stacked_column.js +8 -26
- package/dist/components/charts/tooltip/tooltip.js +0 -6
- package/dist/components/mixins/button_mixin.js +0 -1
- package/dist/components/mixins/safe_link_mixin.js +0 -1
- package/dist/components/mixins/toolbox_mixin.js +0 -1
- package/dist/components/mixins/tooltip_mixin.js +1 -2
- package/dist/components/regions/empty_state/empty_state.js +0 -12
- package/dist/components/utilities/animated_number/animated_number.js +0 -16
- package/dist/components/utilities/friendly_wrap/friendly_wrap.js +0 -3
- package/dist/components/utilities/intersection_observer/intersection_observer.js +0 -7
- package/dist/components/utilities/intersperse/intersperse.js +3 -9
- package/dist/components/utilities/sprintf/sprintf.js +9 -23
- package/dist/components/utilities/truncate/truncate.js +0 -10
- package/dist/config.js +3 -4
- package/dist/directives/hover_load/hover_load.js +2 -8
- package/dist/directives/outside/get_event_like_time_stamp.js +4 -2
- package/dist/directives/outside/outside.js +5 -20
- package/dist/directives/resize_observer/resize_observer.js +0 -10
- package/dist/directives/safe_html/safe_html.js +5 -6
- package/dist/directives/safe_link/mock_data.js +1 -1
- package/dist/directives/safe_link/safe_link.js +0 -13
- package/dist/utils/breakpoints.js +0 -3
- package/dist/utils/charts/config.js +29 -42
- package/dist/utils/charts/constants.js +8 -8
- package/dist/utils/charts/mock_data.js +2 -2
- package/dist/utils/charts/story_config.js +1 -1
- package/dist/utils/charts/theme.js +1 -3
- package/dist/utils/charts/utils.js +2 -6
- package/dist/utils/constants.js +10 -7
- package/dist/utils/data_utils.js +5 -4
- package/dist/utils/datetime_utility.js +4 -4
- package/dist/utils/number_utils.js +7 -11
- package/dist/utils/stories_utils.js +1 -1
- package/dist/utils/story_decorators/container.js +0 -1
- package/dist/utils/string_utils.js +0 -14
- package/dist/utils/test_utils.js +3 -2
- package/dist/utils/use_fake_date.js +0 -4
- package/dist/utils/use_mock_intersection_observer.js +4 -19
- package/dist/utils/utils.js +5 -14
- package/package.json +3 -3
- package/src/components/base/pagination/pagination.vue +2 -2
- package/src/components/base/toast/toast.js +1 -0
|
@@ -4,42 +4,39 @@
|
|
|
4
4
|
* @param {Number} b
|
|
5
5
|
*/
|
|
6
6
|
const addition = (a, b) => a + b;
|
|
7
|
+
|
|
7
8
|
/**
|
|
8
9
|
* Returns the sum of all arguments
|
|
9
10
|
* @param {...Number} numbers
|
|
10
11
|
*/
|
|
11
|
-
|
|
12
12
|
const sum = function () {
|
|
13
13
|
for (var _len = arguments.length, numbers = new Array(_len), _key = 0; _key < _len; _key++) {
|
|
14
14
|
numbers[_key] = arguments[_key];
|
|
15
15
|
}
|
|
16
|
-
|
|
17
16
|
return numbers.reduce(addition);
|
|
18
17
|
};
|
|
18
|
+
|
|
19
19
|
/**
|
|
20
20
|
* Returns the average of all arguments
|
|
21
21
|
* @param {...Number} numbers
|
|
22
22
|
*/
|
|
23
|
-
|
|
24
23
|
const average = function () {
|
|
25
24
|
return sum(...arguments) / arguments.length;
|
|
26
25
|
};
|
|
26
|
+
|
|
27
27
|
/**
|
|
28
28
|
* Convert number to engineering format, using SI suffix
|
|
29
29
|
* @param {Number|String} value - Number or Number-convertible String
|
|
30
30
|
* @param {Number} precision
|
|
31
31
|
* @return {String} number, possibly with a suffix
|
|
32
32
|
*/
|
|
33
|
-
|
|
34
33
|
const engineeringNotation = function (value) {
|
|
35
34
|
let precision = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 2;
|
|
36
35
|
const invalidValues = [NaN, Infinity, -Infinity];
|
|
37
36
|
const num = Number(value);
|
|
38
|
-
|
|
39
37
|
if (invalidValues.includes(num) || invalidValues.includes(Number(precision))) {
|
|
40
38
|
return num.toString();
|
|
41
39
|
}
|
|
42
|
-
|
|
43
40
|
const allYourBase = {
|
|
44
41
|
'-24': 'y',
|
|
45
42
|
'-21': 'z',
|
|
@@ -61,19 +58,18 @@ const engineeringNotation = function (value) {
|
|
|
61
58
|
};
|
|
62
59
|
const exponentialNotation = num.toExponential(precision);
|
|
63
60
|
const power = exponentialNotation.split('e').map(Number)[1] || 0;
|
|
64
|
-
|
|
65
61
|
if (power < -24 || power > 24) {
|
|
66
62
|
return exponentialNotation;
|
|
67
63
|
}
|
|
68
|
-
|
|
69
64
|
const scaledPower = 3 * Math.floor(power / 3);
|
|
70
|
-
const scaledMantissa = (exponentialNotation / 10 ** scaledPower
|
|
71
|
-
|
|
65
|
+
const scaledMantissa = (exponentialNotation / 10 ** scaledPower
|
|
66
|
+
// strip trailing decimals from floating point rounding errors
|
|
67
|
+
).toFixed(precision)
|
|
68
|
+
// strip trailing 0s after a decimal point
|
|
72
69
|
.replace(/\.([1-9]*)0+$/, (_, fractionalDigits) => {
|
|
73
70
|
if (fractionalDigits) {
|
|
74
71
|
return `.${fractionalDigits}`;
|
|
75
72
|
}
|
|
76
|
-
|
|
77
73
|
return '';
|
|
78
74
|
});
|
|
79
75
|
return `${scaledMantissa}${allYourBase[scaledPower]}`;
|
|
@@ -9,10 +9,10 @@ const SERIES_NAME = {
|
|
|
9
9
|
[SERIES_NAME_LONG]: 'Series name long. Lorem ipsum dolor sit amet, consectetur adipiscing elit. Sed tincidunt interdum sapien ut blandit. Nulla fermentum nisi id euismod vulputate. END',
|
|
10
10
|
[SERIES_NAME_LONG_WITHOUT_SPACES]: 'Series_name_long._Lorem_ipsum_dolor_sit_amet,_consectetur_adipiscing_elit._Sed_tincidunt_interdum_sapien_ut_blandit._Nulla_fermentum_nisi_id_euismod_vulputate._END'
|
|
11
11
|
};
|
|
12
|
+
|
|
12
13
|
/**
|
|
13
14
|
* Builds the parameters object disable one or multiple controls.
|
|
14
15
|
*/
|
|
15
|
-
|
|
16
16
|
const disableControls = function () {
|
|
17
17
|
let controls = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : [];
|
|
18
18
|
return Object.fromEntries(controls.map(control => [control, {
|
|
@@ -18,28 +18,21 @@ import emojiRegexFactory from 'emoji-regex';
|
|
|
18
18
|
* @param {string} string The string to split.
|
|
19
19
|
* @returns {string[]} The resulting strings.
|
|
20
20
|
*/
|
|
21
|
-
|
|
22
21
|
const splitAfterSymbols = (symbols, string) => {
|
|
23
22
|
const textParts = [];
|
|
24
23
|
let textPartStartIndex = 0;
|
|
25
|
-
|
|
26
24
|
if (string.length === 0) {
|
|
27
25
|
return [string];
|
|
28
26
|
}
|
|
29
|
-
|
|
30
27
|
for (let i = 0; i < string.length;) {
|
|
31
28
|
let symbolFound = false;
|
|
32
|
-
|
|
33
29
|
for (let j = 0; j < symbols.length; j += 1) {
|
|
34
30
|
const symbol = symbols[j];
|
|
35
|
-
|
|
36
31
|
if (!symbol) {
|
|
37
32
|
// eslint-disable-next-line no-continue
|
|
38
33
|
continue;
|
|
39
34
|
}
|
|
40
|
-
|
|
41
35
|
symbolFound = string.slice(i, i + symbol.length) === symbol;
|
|
42
|
-
|
|
43
36
|
if (symbolFound) {
|
|
44
37
|
const textPartEndIndex = i + symbol.length;
|
|
45
38
|
const textPart = string.slice(textPartStartIndex, textPartEndIndex);
|
|
@@ -49,18 +42,14 @@ const splitAfterSymbols = (symbols, string) => {
|
|
|
49
42
|
break;
|
|
50
43
|
}
|
|
51
44
|
}
|
|
52
|
-
|
|
53
45
|
if (!symbolFound) {
|
|
54
46
|
i += 1;
|
|
55
47
|
}
|
|
56
48
|
}
|
|
57
|
-
|
|
58
49
|
const final = string.slice(textPartStartIndex);
|
|
59
|
-
|
|
60
50
|
if (final) {
|
|
61
51
|
textParts.push(final);
|
|
62
52
|
}
|
|
63
|
-
|
|
64
53
|
return textParts;
|
|
65
54
|
};
|
|
66
55
|
const startsWithEmojiRegex = `^(${emojiRegexFactory().source})`;
|
|
@@ -68,15 +57,12 @@ const getAvatarChar = name => {
|
|
|
68
57
|
if (name) {
|
|
69
58
|
// Check if string starts with an emoji (which could be multiple characters and zero-width joined)
|
|
70
59
|
const match = name.match(startsWithEmojiRegex);
|
|
71
|
-
|
|
72
60
|
if (match) {
|
|
73
61
|
// Return the first match
|
|
74
62
|
return match[0];
|
|
75
63
|
}
|
|
76
|
-
|
|
77
64
|
return name.charAt(0).toUpperCase();
|
|
78
65
|
}
|
|
79
|
-
|
|
80
66
|
return '';
|
|
81
67
|
};
|
|
82
68
|
|
package/dist/utils/test_utils.js
CHANGED
|
@@ -4,9 +4,10 @@
|
|
|
4
4
|
*/
|
|
5
5
|
function setStoryTimeout(fn, timeout) {
|
|
6
6
|
return setTimeout(fn, process.env.IS_VISUAL_TEST ? 0 : timeout);
|
|
7
|
-
}
|
|
8
|
-
// https://github.com/bootstrap-vue/bootstrap-vue/blob/2fd03f0b1d0cc41f9930078ba8b1c16b10e4ac2f/tests/utils.js#L6
|
|
7
|
+
}
|
|
9
8
|
|
|
9
|
+
// adopted this method from Bootstraps utils
|
|
10
|
+
// https://github.com/bootstrap-vue/bootstrap-vue/blob/2fd03f0b1d0cc41f9930078ba8b1c16b10e4ac2f/tests/utils.js#L6
|
|
10
11
|
const waitForAnimationFrame = () => new Promise(resolve => {
|
|
11
12
|
requestAnimationFrame(resolve);
|
|
12
13
|
});
|
|
@@ -12,21 +12,17 @@ import MockDate from 'mockdate';
|
|
|
12
12
|
* mixins: [useFakeDate()],
|
|
13
13
|
* })
|
|
14
14
|
*/
|
|
15
|
-
|
|
16
15
|
const useFakeDate = () => {
|
|
17
16
|
if (process.env.IS_VISUAL_TEST) {
|
|
18
17
|
return {
|
|
19
18
|
created() {
|
|
20
19
|
MockDate.set('2020-01-10', 0);
|
|
21
20
|
},
|
|
22
|
-
|
|
23
21
|
destroyed() {
|
|
24
22
|
MockDate.reset();
|
|
25
23
|
}
|
|
26
|
-
|
|
27
24
|
};
|
|
28
25
|
}
|
|
29
|
-
|
|
30
26
|
return {};
|
|
31
27
|
};
|
|
32
28
|
|
|
@@ -15,19 +15,16 @@ class MockObserver {
|
|
|
15
15
|
this.$_cb = cb;
|
|
16
16
|
this.$_observers = [];
|
|
17
17
|
}
|
|
18
|
-
|
|
19
18
|
observe(node) {
|
|
20
19
|
let options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
|
|
21
20
|
this.$_observers.push([node, options]);
|
|
22
21
|
}
|
|
23
|
-
|
|
24
22
|
disconnect() {
|
|
25
23
|
this.$_observers = [];
|
|
26
24
|
}
|
|
25
|
+
takeRecords() {}
|
|
27
26
|
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
27
|
+
// eslint-disable-next-line camelcase
|
|
31
28
|
$_triggerObserve(nodeParam) {
|
|
32
29
|
let {
|
|
33
30
|
entry = {},
|
|
@@ -42,9 +39,9 @@ class MockObserver {
|
|
|
42
39
|
}]);
|
|
43
40
|
}
|
|
44
41
|
});
|
|
45
|
-
}
|
|
46
|
-
|
|
42
|
+
}
|
|
47
43
|
|
|
44
|
+
// eslint-disable-next-line camelcase
|
|
48
45
|
$_hasObserver(node) {
|
|
49
46
|
let options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
|
|
50
47
|
return this.$_observers.some(_ref => {
|
|
@@ -52,7 +49,6 @@ class MockObserver {
|
|
|
52
49
|
return node === obvNode && _isMatch(options, obvOptions);
|
|
53
50
|
});
|
|
54
51
|
}
|
|
55
|
-
|
|
56
52
|
$_getNodesFromParam(nodeParam) {
|
|
57
53
|
if (!nodeParam) {
|
|
58
54
|
return this.$_observers.map(_ref2 => {
|
|
@@ -60,16 +56,12 @@ class MockObserver {
|
|
|
60
56
|
return node;
|
|
61
57
|
});
|
|
62
58
|
}
|
|
63
|
-
|
|
64
59
|
if (!_isArray(nodeParam)) {
|
|
65
60
|
return [nodeParam];
|
|
66
61
|
}
|
|
67
|
-
|
|
68
62
|
return nodeParam;
|
|
69
63
|
}
|
|
70
|
-
|
|
71
64
|
}
|
|
72
|
-
|
|
73
65
|
class MockIntersectionObserver extends MockObserver {
|
|
74
66
|
unobserve(node) {
|
|
75
67
|
this.$_observers = this.$_observers.filter(_ref3 => {
|
|
@@ -77,9 +69,7 @@ class MockIntersectionObserver extends MockObserver {
|
|
|
77
69
|
return node !== obvNode;
|
|
78
70
|
});
|
|
79
71
|
}
|
|
80
|
-
|
|
81
72
|
}
|
|
82
|
-
|
|
83
73
|
const useMockIntersectionObserver = () => {
|
|
84
74
|
let instances;
|
|
85
75
|
let origObserver;
|
|
@@ -90,7 +80,6 @@ const useMockIntersectionObserver = () => {
|
|
|
90
80
|
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
|
|
91
81
|
args[_key] = arguments[_key];
|
|
92
82
|
}
|
|
93
|
-
|
|
94
83
|
const mockObserver = new MockIntersectionObserver(...args);
|
|
95
84
|
instances.push(mockObserver);
|
|
96
85
|
return mockObserver;
|
|
@@ -100,19 +89,15 @@ const useMockIntersectionObserver = () => {
|
|
|
100
89
|
instances = [];
|
|
101
90
|
global.IntersectionObserver = origObserver;
|
|
102
91
|
});
|
|
103
|
-
|
|
104
92
|
const trigger = function (observer) {
|
|
105
93
|
for (var _len2 = arguments.length, args = new Array(_len2 > 1 ? _len2 - 1 : 0), _key2 = 1; _key2 < _len2; _key2++) {
|
|
106
94
|
args[_key2 - 1] = arguments[_key2];
|
|
107
95
|
}
|
|
108
|
-
|
|
109
96
|
observer.$_triggerObserve(...args);
|
|
110
97
|
};
|
|
111
|
-
|
|
112
98
|
const getInstances = () => {
|
|
113
99
|
return instances;
|
|
114
100
|
};
|
|
115
|
-
|
|
116
101
|
return {
|
|
117
102
|
getInstances,
|
|
118
103
|
trigger
|
package/dist/utils/utils.js
CHANGED
|
@@ -6,11 +6,9 @@ function debounceByAnimationFrame(fn) {
|
|
|
6
6
|
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
|
|
7
7
|
args[_key] = arguments[_key];
|
|
8
8
|
}
|
|
9
|
-
|
|
10
9
|
if (requestId) {
|
|
11
10
|
window.cancelAnimationFrame(requestId);
|
|
12
11
|
}
|
|
13
|
-
|
|
14
12
|
requestId = window.requestAnimationFrame(() => fn.apply(this, args));
|
|
15
13
|
};
|
|
16
14
|
}
|
|
@@ -20,11 +18,9 @@ function throttle(fn) {
|
|
|
20
18
|
for (var _len2 = arguments.length, args = new Array(_len2), _key2 = 0; _key2 < _len2; _key2++) {
|
|
21
19
|
args[_key2] = arguments[_key2];
|
|
22
20
|
}
|
|
23
|
-
|
|
24
21
|
if (frameId) {
|
|
25
22
|
return;
|
|
26
23
|
}
|
|
27
|
-
|
|
28
24
|
frameId = window.requestAnimationFrame(() => {
|
|
29
25
|
fn(...args);
|
|
30
26
|
frameId = null;
|
|
@@ -51,7 +47,6 @@ function colorFromBackground(backgroundColor) {
|
|
|
51
47
|
let r;
|
|
52
48
|
let g;
|
|
53
49
|
let b;
|
|
54
|
-
|
|
55
50
|
if (backgroundColor.startsWith('#')) {
|
|
56
51
|
[r, g, b] = rgbFromHex(backgroundColor);
|
|
57
52
|
} else if (backgroundColor.startsWith('rgba(')) {
|
|
@@ -59,16 +54,15 @@ function colorFromBackground(backgroundColor) {
|
|
|
59
54
|
} else if (backgroundColor.startsWith('rgb(')) {
|
|
60
55
|
[r, g, b] = rgbFromString(backgroundColor, 4);
|
|
61
56
|
}
|
|
62
|
-
|
|
63
57
|
if (r + g + b <= 500) {
|
|
64
58
|
return labelColorOptions.light;
|
|
65
59
|
}
|
|
66
|
-
|
|
67
60
|
return labelColorOptions.dark;
|
|
68
61
|
}
|
|
69
62
|
function uid() {
|
|
70
63
|
return Math.random().toString(36).substring(2);
|
|
71
64
|
}
|
|
65
|
+
|
|
72
66
|
/**
|
|
73
67
|
* Receives an element and validates that it can be focused
|
|
74
68
|
* @param { HTMLElement } The element we want to validate
|
|
@@ -87,6 +81,7 @@ function isElementFocusable(elt) {
|
|
|
87
81
|
const isInvalidAnchorTag = tagName === 'A' && !elt.getAttribute('href');
|
|
88
82
|
return isValidTag && hasValidType && !isDisabled && hasValidZIndex && !isInvalidAnchorTag;
|
|
89
83
|
}
|
|
84
|
+
|
|
90
85
|
/**
|
|
91
86
|
* Receives an array of HTML elements and focus the first one possible
|
|
92
87
|
* @param { Array.<HTMLElement> } An array of element to potentially focus
|
|
@@ -97,47 +92,43 @@ function focusFirstFocusableElement(elts) {
|
|
|
97
92
|
const focusableElt = elts.find(el => isElementFocusable(el));
|
|
98
93
|
if (focusableElt) focusableElt.focus();
|
|
99
94
|
}
|
|
95
|
+
|
|
100
96
|
/**
|
|
101
97
|
* Returns true if the current environment is considered a development environment (it's not
|
|
102
98
|
* production or test).
|
|
103
99
|
*
|
|
104
100
|
* @returns {boolean}
|
|
105
101
|
*/
|
|
106
|
-
|
|
107
102
|
function isDev() {
|
|
108
103
|
return !['test', 'production'].includes(process.env.NODE_ENV);
|
|
109
104
|
}
|
|
105
|
+
|
|
110
106
|
/**
|
|
111
107
|
* Prints a warning message to the console in non-test and non-production environments.
|
|
112
108
|
* @param {string} message message to print to the console
|
|
113
109
|
*/
|
|
114
|
-
|
|
115
110
|
function logWarning() {
|
|
116
111
|
let message = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : '';
|
|
117
|
-
|
|
118
112
|
if (message.length && isDev()) {
|
|
119
113
|
console.warn(message); // eslint-disable-line no-console
|
|
120
114
|
}
|
|
121
115
|
}
|
|
116
|
+
|
|
122
117
|
/**
|
|
123
118
|
* Stop default event handling and propagation
|
|
124
119
|
*/
|
|
125
|
-
|
|
126
120
|
function stopEvent(event) {
|
|
127
121
|
let {
|
|
128
122
|
preventDefault = true,
|
|
129
123
|
stopPropagation = true,
|
|
130
124
|
stopImmediatePropagation = false
|
|
131
125
|
} = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
|
|
132
|
-
|
|
133
126
|
if (preventDefault) {
|
|
134
127
|
event.preventDefault();
|
|
135
128
|
}
|
|
136
|
-
|
|
137
129
|
if (stopPropagation) {
|
|
138
130
|
event.stopPropagation();
|
|
139
131
|
}
|
|
140
|
-
|
|
141
132
|
if (stopImmediatePropagation) {
|
|
142
133
|
event.stopImmediatePropagation();
|
|
143
134
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@gitlab/ui",
|
|
3
|
-
"version": "49.0.
|
|
3
|
+
"version": "49.0.3",
|
|
4
4
|
"description": "GitLab UI Components",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"main": "dist/index.js",
|
|
@@ -77,7 +77,7 @@
|
|
|
77
77
|
},
|
|
78
78
|
"devDependencies": {
|
|
79
79
|
"@arkweid/lefthook": "0.7.7",
|
|
80
|
-
"@babel/core": "^7.19.
|
|
80
|
+
"@babel/core": "^7.19.6",
|
|
81
81
|
"@babel/preset-env": "^7.19.4",
|
|
82
82
|
"@gitlab/eslint-plugin": "18.1.0",
|
|
83
83
|
"@gitlab/stylelint-config": "4.1.0",
|
|
@@ -104,7 +104,7 @@
|
|
|
104
104
|
"bootstrap": "4.5.3",
|
|
105
105
|
"cypress": "^10.10.0",
|
|
106
106
|
"emoji-regex": "^10.0.0",
|
|
107
|
-
"eslint": "8.
|
|
107
|
+
"eslint": "8.26.0",
|
|
108
108
|
"eslint-import-resolver-jest": "3.0.2",
|
|
109
109
|
"eslint-plugin-cypress": "2.12.1",
|
|
110
110
|
"eslint-plugin-storybook": "0.6.6",
|
|
@@ -375,8 +375,8 @@ export default {
|
|
|
375
375
|
</script>
|
|
376
376
|
|
|
377
377
|
<template>
|
|
378
|
-
<nav aria-label="Pagination">
|
|
379
|
-
<ul
|
|
378
|
+
<nav v-if="isVisible" class="gl-pagination text-nowrap" aria-label="Pagination">
|
|
379
|
+
<ul class="pagination" :class="wrapperClasses">
|
|
380
380
|
<li
|
|
381
381
|
class="page-item"
|
|
382
382
|
:class="{
|