@gitlab/ui 32.51.0 → 32.52.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 +28 -0
- package/dist/components/base/breadcrumb/breadcrumb.documentation.js +1 -1
- package/dist/components/regions/empty_state/empty_state.js +4 -1
- package/dist/index.css +1 -1
- package/dist/index.css.map +1 -1
- package/dist/utility_classes.css +1 -1
- package/dist/utility_classes.css.map +1 -1
- package/dist/utils/string_utils.js +6 -2
- package/package.json +3 -1
- package/src/components/base/breadcrumb/breadcrumb.md +6 -5
- package/src/components/base/breadcrumb/breadcrumb.scss +1 -1
- package/src/components/base/breadcrumb/breadcrumb.stories.js +4 -1
- package/src/components/regions/empty_state/empty_state.vue +12 -4
- package/src/scss/utilities.scss +6 -0
- package/src/scss/utility-mixins/index.scss +1 -0
- package/src/scss/utility-mixins/mix-blend-mode.scss +3 -0
- package/src/utils/string_utils.js +6 -2
- package/src/utils/string_utils.spec.js +8 -0
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
import emojiRegexFactory from 'emoji-regex';
|
|
2
|
+
|
|
1
3
|
/**
|
|
2
4
|
* Split the given string after each occurrence of each of the given symbols.
|
|
3
5
|
*
|
|
@@ -16,6 +18,7 @@
|
|
|
16
18
|
* @param {string} string The string to split.
|
|
17
19
|
* @returns {string[]} The resulting strings.
|
|
18
20
|
*/
|
|
21
|
+
|
|
19
22
|
const splitAfterSymbols = (symbols, string) => {
|
|
20
23
|
const textParts = [];
|
|
21
24
|
let textPartStartIndex = 0;
|
|
@@ -60,10 +63,11 @@ const splitAfterSymbols = (symbols, string) => {
|
|
|
60
63
|
|
|
61
64
|
return textParts;
|
|
62
65
|
};
|
|
66
|
+
const startsWithEmojiRegex = `^(${emojiRegexFactory().source})`;
|
|
63
67
|
const getAvatarChar = name => {
|
|
64
68
|
if (name) {
|
|
65
|
-
// Check if
|
|
66
|
-
const match = name.match(
|
|
69
|
+
// Check if string starts with an emoji (which could be multiple characters and zero-width joined)
|
|
70
|
+
const match = name.match(startsWithEmojiRegex);
|
|
67
71
|
|
|
68
72
|
if (match) {
|
|
69
73
|
// Return the first match
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@gitlab/ui",
|
|
3
|
-
"version": "32.
|
|
3
|
+
"version": "32.52.0",
|
|
4
4
|
"description": "GitLab UI Components",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"main": "dist/index.js",
|
|
@@ -72,6 +72,7 @@
|
|
|
72
72
|
},
|
|
73
73
|
"peerDependencies": {
|
|
74
74
|
"@gitlab/svgs": "^1.116.0 || ^2.0.0",
|
|
75
|
+
"emoji-regex": ">=10.0.0",
|
|
75
76
|
"bootstrap": "4.5.3",
|
|
76
77
|
"pikaday": "^1.8.0",
|
|
77
78
|
"vue": "^2.6.10"
|
|
@@ -107,6 +108,7 @@
|
|
|
107
108
|
"babel-preset-vue": "^2.0.2",
|
|
108
109
|
"bootstrap": "4.5.3",
|
|
109
110
|
"cypress": "^6.6.0",
|
|
111
|
+
"emoji-regex": "^10.0.0",
|
|
110
112
|
"eslint": "7.32.0",
|
|
111
113
|
"eslint-import-resolver-jest": "3.0.2",
|
|
112
114
|
"eslint-plugin-cypress": "2.12.1",
|
|
@@ -15,15 +15,16 @@ to draw a `/`
|
|
|
15
15
|
```html
|
|
16
16
|
<gl-breadcrumb :items="items">
|
|
17
17
|
<template #avatar>
|
|
18
|
-
<img
|
|
18
|
+
<img
|
|
19
|
+
alt=""
|
|
19
20
|
class="gl-breadcrumb-avatar-tile"
|
|
20
|
-
src="https://assets.gitlab-static.net/uploads/-/system/group/avatar/9970/logo-extra-whitespace.png?width=
|
|
21
|
-
width="
|
|
22
|
-
height="
|
|
21
|
+
src="https://assets.gitlab-static.net/uploads/-/system/group/avatar/9970/logo-extra-whitespace.png?width=16"
|
|
22
|
+
width="16"
|
|
23
|
+
height="16"
|
|
23
24
|
/>
|
|
24
25
|
</template>
|
|
25
26
|
<template #separator>
|
|
26
|
-
<svg
|
|
27
|
+
<svg height="16">
|
|
27
28
|
<line x1="100%" y1="0" x2="0" y2="100%" stroke="gray" />
|
|
28
29
|
</svg>
|
|
29
30
|
</template>
|
|
@@ -6,7 +6,10 @@ const template = `
|
|
|
6
6
|
:items="items"
|
|
7
7
|
>
|
|
8
8
|
<template #avatar>
|
|
9
|
-
<img
|
|
9
|
+
<img alt=""
|
|
10
|
+
class="gl-breadcrumb-avatar-tile" src="https://assets.gitlab-static.net/uploads/-/system/group/avatar/9970/logo-extra-whitespace.png?width=16"
|
|
11
|
+
width="16"
|
|
12
|
+
height="16" />
|
|
10
13
|
</template>
|
|
11
14
|
</gl-breadcrumb>
|
|
12
15
|
`;
|
|
@@ -96,14 +96,22 @@ export default {
|
|
|
96
96
|
</script>
|
|
97
97
|
|
|
98
98
|
<template>
|
|
99
|
-
<section
|
|
100
|
-
|
|
99
|
+
<section
|
|
100
|
+
class="gl-display-flex gl-flex-wrap"
|
|
101
|
+
:class="{
|
|
102
|
+
'empty-state gl-text-center gl-flex-direction-column': !compact,
|
|
103
|
+
'gl-flex-direction-row': compact,
|
|
104
|
+
}"
|
|
105
|
+
>
|
|
106
|
+
<div
|
|
107
|
+
:class="{ 'gl-display-none gl-sm-display-block gl-px-4': compact, 'gl-max-w-full': !compact }"
|
|
108
|
+
>
|
|
101
109
|
<div v-if="svgPath" :class="{ 'svg-content': !compact }" class="svg-250">
|
|
102
110
|
<img :src="svgPath" alt="" role="img" class="gl-max-w-full" :height="height" />
|
|
103
111
|
</div>
|
|
104
112
|
</div>
|
|
105
|
-
<div :class="compact ? '
|
|
106
|
-
<div class="
|
|
113
|
+
<div :class="compact ? 'gl-flex-grow-1 gl-flex-basis-0 gl-px-4' : 'gl-max-w-full gl-m-auto'">
|
|
114
|
+
<div class="gl-mx-auto gl-my-0" :class="{ 'gl-p-5': !compact }">
|
|
107
115
|
<h1
|
|
108
116
|
ref="title"
|
|
109
117
|
class="gl-font-size-h-display gl-line-height-36"
|
package/src/scss/utilities.scss
CHANGED
|
@@ -3306,6 +3306,12 @@
|
|
|
3306
3306
|
mask-position: center !important;
|
|
3307
3307
|
mask-size: cover !important
|
|
3308
3308
|
}
|
|
3309
|
+
.gl-mix-blend-mode-luminosity {
|
|
3310
|
+
mix-blend-mode: luminosity
|
|
3311
|
+
}
|
|
3312
|
+
.gl-mix-blend-mode-luminosity\! {
|
|
3313
|
+
mix-blend-mode: luminosity !important
|
|
3314
|
+
}
|
|
3309
3315
|
.gl-opacity-0 {
|
|
3310
3316
|
opacity: 0
|
|
3311
3317
|
}
|
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
import emojiRegexFactory from 'emoji-regex';
|
|
2
|
+
|
|
1
3
|
/**
|
|
2
4
|
* Split the given string after each occurrence of each of the given symbols.
|
|
3
5
|
*
|
|
@@ -60,10 +62,12 @@ export const splitAfterSymbols = (symbols, string) => {
|
|
|
60
62
|
return textParts;
|
|
61
63
|
};
|
|
62
64
|
|
|
65
|
+
const startsWithEmojiRegex = `^(${emojiRegexFactory().source})`;
|
|
66
|
+
|
|
63
67
|
export const getAvatarChar = (name) => {
|
|
64
68
|
if (name) {
|
|
65
|
-
// Check if
|
|
66
|
-
const match = name.match(
|
|
69
|
+
// Check if string starts with an emoji (which could be multiple characters and zero-width joined)
|
|
70
|
+
const match = name.match(startsWithEmojiRegex);
|
|
67
71
|
if (match) {
|
|
68
72
|
// Return the first match
|
|
69
73
|
return match[0];
|
|
@@ -44,5 +44,13 @@ describe('string utils', () => {
|
|
|
44
44
|
it('Returns first character if emoji is not first in name', () => {
|
|
45
45
|
expect(getAvatarChar('tanuki🦊')).toBe('T');
|
|
46
46
|
});
|
|
47
|
+
|
|
48
|
+
it('Returns zero-width joined emoji if the name starts with it', () => {
|
|
49
|
+
expect(getAvatarChar('🏴☠️Zero-width join')).toBe('🏴☠️');
|
|
50
|
+
});
|
|
51
|
+
|
|
52
|
+
it('Returns only first emoji if the name starts with multiple', () => {
|
|
53
|
+
expect(getAvatarChar('🏴☠️🙂Multiple Emoji')).toBe('🏴☠️');
|
|
54
|
+
});
|
|
47
55
|
});
|
|
48
56
|
});
|