@gitlab/ui 85.10.0 → 85.12.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 +14 -0
- package/dist/components/base/new_dropdowns/listbox/listbox.js +2 -8
- package/dist/components/base/pagination/pagination.js +15 -5
- package/dist/index.css +2 -2
- package/dist/index.css.map +1 -1
- package/dist/tokens/build/js/tokens.dark.js +2 -1
- package/dist/tokens/build/js/tokens.js +2 -1
- package/dist/tokens/css/tokens.css +1 -0
- package/dist/tokens/css/tokens.dark.css +1 -0
- package/dist/tokens/js/tokens.dark.js +1 -0
- package/dist/tokens/js/tokens.js +1 -0
- package/dist/tokens/json/tokens.dark.json +22 -0
- package/dist/tokens/json/tokens.json +22 -0
- package/dist/tokens/scss/_tokens.dark.scss +1 -0
- package/dist/tokens/scss/_tokens.scss +1 -0
- package/dist/tokens/scss/_tokens_custom_properties.scss +1 -0
- package/dist/tokens/tailwind/tokens.cjs +2 -0
- package/dist/utils/i18n.js +49 -1
- package/package.json +3 -3
- package/src/components/base/modal/modal.scss +6 -4
- package/src/components/base/new_dropdowns/listbox/listbox.vue +6 -8
- package/src/components/base/pagination/pagination.vue +18 -5
- package/src/tokens/background.tokens.json +8 -0
- package/src/tokens/build/css/tokens.css +1 -0
- package/src/tokens/build/css/tokens.dark.css +1 -0
- package/src/tokens/build/js/tokens.dark.js +1 -0
- package/src/tokens/build/js/tokens.js +1 -0
- package/src/tokens/build/json/tokens.dark.json +22 -0
- package/src/tokens/build/json/tokens.json +22 -0
- package/src/tokens/build/scss/_tokens.dark.scss +1 -0
- package/src/tokens/build/scss/_tokens.scss +1 -0
- package/src/tokens/build/scss/_tokens_custom_properties.scss +1 -0
- package/src/tokens/build/tailwind/tokens.cjs +2 -0
- package/src/utils/i18n.js +52 -0
- package/translations.js +2 -1
|
@@ -532,6 +532,7 @@ $gl-border-color-transparent: $gl-color-alpha-0; // Used when a border needs to
|
|
|
532
532
|
$gl-border-color-strong: $gl-color-neutral-400; // Used for a distinct border that emphasizes an edge or boundaries.
|
|
533
533
|
$gl-border-color-subtle: $gl-color-neutral-900; // Used for a border that has a little more definition, or is used in combination with a subtle background.
|
|
534
534
|
$gl-border-color-default: $gl-color-neutral-800; // Used for the default border color.
|
|
535
|
+
$gl-background-color-overlay: rgba(0,0,0,0.64); // Used for an overlay that covers other content.
|
|
535
536
|
$gl-background-color-disabled: $gl-color-neutral-900; // Used to identify a disabled section.
|
|
536
537
|
$gl-background-color-strong: $gl-color-neutral-800; // Used to make the background easily stand out from the default.
|
|
537
538
|
$gl-background-color-subtle: $gl-color-neutral-900; // Used to slightly differentiate the background from the default.
|
|
@@ -532,6 +532,7 @@ $gl-border-color-transparent: $gl-color-alpha-0; // Used when a border needs to
|
|
|
532
532
|
$gl-border-color-strong: $gl-color-neutral-400; // Used for a distinct border that emphasizes an edge or boundaries.
|
|
533
533
|
$gl-border-color-subtle: $gl-color-neutral-50; // Used for a border that has a little more definition, or is used in combination with a subtle background.
|
|
534
534
|
$gl-border-color-default: $gl-color-neutral-100; // Used for the default border color.
|
|
535
|
+
$gl-background-color-overlay: $gl-color-alpha-dark-24; // Used for an overlay that covers other content.
|
|
535
536
|
$gl-background-color-disabled: $gl-color-neutral-10; // Used to identify a disabled section.
|
|
536
537
|
$gl-background-color-strong: $gl-color-neutral-50; // Used to make the background easily stand out from the default.
|
|
537
538
|
$gl-background-color-subtle: $gl-color-neutral-10; // Used to slightly differentiate the background from the default.
|
|
@@ -74,6 +74,7 @@ $gl-background-color-default: var(--gl-background-color-default);
|
|
|
74
74
|
$gl-background-color-subtle: var(--gl-background-color-subtle);
|
|
75
75
|
$gl-background-color-strong: var(--gl-background-color-strong);
|
|
76
76
|
$gl-background-color-disabled: var(--gl-background-color-disabled);
|
|
77
|
+
$gl-background-color-overlay: var(--gl-background-color-overlay);
|
|
77
78
|
$gl-border-color-default: var(--gl-border-color-default);
|
|
78
79
|
$gl-border-color-subtle: var(--gl-border-color-subtle);
|
|
79
80
|
$gl-border-color-strong: var(--gl-border-color-strong);
|
|
@@ -223,6 +223,8 @@ const backgroundColors = {
|
|
|
223
223
|
'var(--gl-background-color-strong, var(--gl-color-neutral-50, #ececef))',
|
|
224
224
|
disabled:
|
|
225
225
|
'var(--gl-background-color-disabled, var(--gl-color-neutral-10, #fbfafd))',
|
|
226
|
+
overlay:
|
|
227
|
+
'var(--gl-background-color-overlay, var(--gl-color-alpha-dark-24, rgba(31, 30, 36, 0.24)))',
|
|
226
228
|
};
|
|
227
229
|
const borderColors = {
|
|
228
230
|
default:
|
package/src/utils/i18n.js
CHANGED
|
@@ -1,5 +1,12 @@
|
|
|
1
|
+
import escape from 'lodash/escape';
|
|
1
2
|
import { i18n } from '../config';
|
|
2
3
|
|
|
4
|
+
const defaultPluralHandler = (n, singleValue, pluralValue) => {
|
|
5
|
+
const value = n === 1 ? singleValue : pluralValue;
|
|
6
|
+
|
|
7
|
+
return value.replace(/%d/g, n);
|
|
8
|
+
};
|
|
9
|
+
|
|
3
10
|
/**
|
|
4
11
|
* Mark a label as translatable.
|
|
5
12
|
*
|
|
@@ -8,3 +15,48 @@ import { i18n } from '../config';
|
|
|
8
15
|
* @returns {string} The translated label.
|
|
9
16
|
*/
|
|
10
17
|
export const translate = (key, defaultValue) => i18n[key] ?? defaultValue;
|
|
18
|
+
|
|
19
|
+
/**
|
|
20
|
+
* Marks a label as translatable and pluralized.
|
|
21
|
+
*
|
|
22
|
+
* @param {*} key Translation key to be leveraged by the consumer to provide a generic translation at configuration time.
|
|
23
|
+
* @param {*} singularValue The singular value to be relied on if the consumer doesn't have translation capabilities.
|
|
24
|
+
* @param {*} pluralValue The plural value to be relied on if the consumer doesn't have translation capabilities.
|
|
25
|
+
* @returns {function} A function that takes a number and returns the pluralized translated label.
|
|
26
|
+
*/
|
|
27
|
+
export const translatePlural = (key, singularValue, pluralValue) => {
|
|
28
|
+
if (i18n[key]) {
|
|
29
|
+
return i18n[key];
|
|
30
|
+
}
|
|
31
|
+
return (x) => defaultPluralHandler(x, singularValue, pluralValue);
|
|
32
|
+
};
|
|
33
|
+
|
|
34
|
+
/**
|
|
35
|
+
* Very limited implementation of sprintf supporting only named parameters.
|
|
36
|
+
* Copied from the GitLab repo: https://gitlab.com/gitlab-org/gitlab/-/blob/0dff8b02accb3dccbf6cd31236834c37013aad59/app/assets/javascripts/locale/sprintf.js.
|
|
37
|
+
* @param {string} input - (translated) text with parameters (e.g. '%{num_users} users use us')
|
|
38
|
+
* @param {Object.<string, string|number>} [parameters] - object mapping parameter names to values (e.g. { num_users: 5 })
|
|
39
|
+
* @param {boolean} [escapeParameters=true] - whether parameter values should be escaped (see https://lodash.com/docs/4.17.15#escape)
|
|
40
|
+
* @returns {string} the text with parameters replaces (e.g. '5 users use us')
|
|
41
|
+
* @see https://ruby-doc.org/core-2.3.3/Kernel.html#method-i-sprintf
|
|
42
|
+
* @see https://gitlab.com/gitlab-org/gitlab-foss/issues/37992
|
|
43
|
+
*/
|
|
44
|
+
export function sprintf(input, parameters, escapeParameters = true) {
|
|
45
|
+
let output = input;
|
|
46
|
+
|
|
47
|
+
output = output.replace(/%+/g, '%');
|
|
48
|
+
|
|
49
|
+
if (parameters) {
|
|
50
|
+
const mappedParameters = new Map(Object.entries(parameters));
|
|
51
|
+
|
|
52
|
+
mappedParameters.forEach((key, parameterName) => {
|
|
53
|
+
const parameterValue = mappedParameters.get(parameterName);
|
|
54
|
+
const escapedParameterValue = escapeParameters ? escape(parameterValue) : parameterValue;
|
|
55
|
+
// Pass the param value as a function to ignore special replacement patterns like $` and $'.
|
|
56
|
+
// https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/replace#syntax
|
|
57
|
+
output = output.replace(new RegExp(`%{${parameterName}}`, 'g'), () => escapedParameterValue);
|
|
58
|
+
});
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
return output;
|
|
62
|
+
}
|
package/translations.js
CHANGED
|
@@ -2,10 +2,11 @@
|
|
|
2
2
|
export default {
|
|
3
3
|
'ClearIconButton.title': 'Clear',
|
|
4
4
|
'GlBreadcrumb.showMoreLabel': 'Show more breadcrumbs',
|
|
5
|
-
'GlCollapsibleListbox.srOnlyResultsLabel':
|
|
5
|
+
'GlCollapsibleListbox.srOnlyResultsLabel': null,
|
|
6
6
|
'GlKeysetPagination.navigationLabel': 'Pagination',
|
|
7
7
|
'GlKeysetPagination.nextText': 'Next',
|
|
8
8
|
'GlKeysetPagination.prevText': 'Previous',
|
|
9
|
+
'GlPagination.labelPage': 'Go to page %{page}',
|
|
9
10
|
'GlSearchBoxByType.clearButtonTitle': 'Clear',
|
|
10
11
|
'GlSearchBoxByType.input.placeholder': 'Search',
|
|
11
12
|
'GlSorting.sortAscending': 'Sort direction: ascending',
|