@gitlab/ui 79.1.1 → 79.3.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 +19 -0
- package/dist/components/base/new_dropdowns/base_dropdown/base_dropdown.js +9 -6
- package/dist/components/base/new_dropdowns/constants.js +2 -2
- package/dist/components/base/pagination/pagination.js +3 -3
- package/dist/components/experimental/duo/chat/components/duo_chat_message/duo_chat_message.js +17 -8
- package/dist/index.css +1 -1
- package/dist/index.css.map +1 -1
- package/dist/tokens/css/tokens.css +12 -4
- package/dist/tokens/css/tokens.dark.css +10 -4
- package/dist/tokens/js/tokens.dark.js +10 -4
- package/dist/tokens/js/tokens.js +12 -4
- package/dist/tokens/json/tokens.dark.grouped.json +9 -1
- package/dist/tokens/json/tokens.dark.json +182 -0
- package/dist/tokens/json/tokens.grouped.json +9 -1
- package/dist/tokens/json/tokens.json +182 -0
- package/dist/tokens/scss/_tokens.dark.scss +10 -4
- package/dist/tokens/scss/_tokens.scss +12 -4
- package/dist/tokens/tokens_story.js +7 -1
- package/dist/utils/utils.js +19 -1
- package/package.json +1 -1
- package/src/components/base/new_dropdowns/base_dropdown/base_dropdown.spec.js +31 -26
- package/src/components/base/new_dropdowns/base_dropdown/base_dropdown.vue +16 -6
- package/src/components/base/new_dropdowns/constants.js +1 -1
- package/src/components/base/pagination/pagination.vue +6 -0
- package/src/components/experimental/duo/chat/components/duo_chat_message/duo_chat_message.scss +15 -1
- package/src/components/experimental/duo/chat/components/duo_chat_message/duo_chat_message.spec.js +51 -45
- package/src/components/experimental/duo/chat/components/duo_chat_message/duo_chat_message.stories.js +8 -0
- package/src/components/experimental/duo/chat/components/duo_chat_message/duo_chat_message.vue +52 -28
- package/src/tokens/text.dark.tokens.json +44 -0
- package/src/tokens/text.dark.tokens.stories.js +6 -1
- package/src/tokens/text.tokens.json +56 -0
- package/src/tokens/text.tokens.stories.js +6 -1
- package/src/tokens/tokens_story.vue +12 -1
- package/src/utils/utils.js +18 -0
- package/src/utils/utils.spec.js +52 -0
- package/tailwind.defaults.js +10 -5
|
@@ -3,7 +3,12 @@ import { createDesignTokenStory } from './common_story_options';
|
|
|
3
3
|
|
|
4
4
|
export const Default = createDesignTokenStory({
|
|
5
5
|
containerClass: 'gl-bg-gray-950',
|
|
6
|
-
tokens:
|
|
6
|
+
tokens: {
|
|
7
|
+
primary: COMPILED_TOKENS.text.primary,
|
|
8
|
+
secondary: COMPILED_TOKENS.text.secondary,
|
|
9
|
+
tertiary: COMPILED_TOKENS.text.tertiary,
|
|
10
|
+
...COMPILED_TOKENS.text.color,
|
|
11
|
+
},
|
|
7
12
|
isBackgroundColorStory: false,
|
|
8
13
|
});
|
|
9
14
|
|
|
@@ -3,17 +3,73 @@
|
|
|
3
3
|
"primary": {
|
|
4
4
|
"$value": "#333238",
|
|
5
5
|
"$type": "color",
|
|
6
|
+
"$description": "Use text.color.strong instead",
|
|
7
|
+
"deprecated": true,
|
|
6
8
|
"themeable": true
|
|
7
9
|
},
|
|
8
10
|
"secondary": {
|
|
9
11
|
"$value": "#737278",
|
|
10
12
|
"$type": "color",
|
|
13
|
+
"$description": "Use text.color.subtle instead",
|
|
14
|
+
"deprecated": true,
|
|
11
15
|
"themeable": true
|
|
12
16
|
},
|
|
13
17
|
"tertiary": {
|
|
14
18
|
"$value": "#89888d",
|
|
15
19
|
"$type": "color",
|
|
20
|
+
"$description": "Use text.color.disabled instead",
|
|
21
|
+
"deprecated": true,
|
|
16
22
|
"themeable": true
|
|
23
|
+
},
|
|
24
|
+
"color": {
|
|
25
|
+
"default": {
|
|
26
|
+
"$value": "#434248",
|
|
27
|
+
"$type": "color",
|
|
28
|
+
"$description": "Used for the default text color.",
|
|
29
|
+
"themeable": true
|
|
30
|
+
},
|
|
31
|
+
"subtle": {
|
|
32
|
+
"$value": "#626168",
|
|
33
|
+
"$type": "color",
|
|
34
|
+
"$description": "Used for supplemental text that doesn't need to be as prominent as other text.",
|
|
35
|
+
"themeable": true
|
|
36
|
+
},
|
|
37
|
+
"strong": {
|
|
38
|
+
"$value": "#1f1e24",
|
|
39
|
+
"$type": "color",
|
|
40
|
+
"$description": "Used for text with the highest contrast.",
|
|
41
|
+
"themeable": true
|
|
42
|
+
},
|
|
43
|
+
"heading": {
|
|
44
|
+
"$value": "#1f1e24",
|
|
45
|
+
"$type": "color",
|
|
46
|
+
"$description": "Used for headings level 1-6.",
|
|
47
|
+
"themeable": true
|
|
48
|
+
},
|
|
49
|
+
"link": {
|
|
50
|
+
"$value": "#0b5cad",
|
|
51
|
+
"$type": "color",
|
|
52
|
+
"$description": "Used for default text links.",
|
|
53
|
+
"themeable": true
|
|
54
|
+
},
|
|
55
|
+
"danger": {
|
|
56
|
+
"$value": "#c91c00",
|
|
57
|
+
"$type": "color",
|
|
58
|
+
"$description": "Used for text indicating a problem, critical state, destructive action, error, failure, removal, stop, or declination.",
|
|
59
|
+
"themeable": true
|
|
60
|
+
},
|
|
61
|
+
"success": {
|
|
62
|
+
"$value": "#217645",
|
|
63
|
+
"$type": "color",
|
|
64
|
+
"$description": "Used for text indicating success or validity.",
|
|
65
|
+
"themeable": true
|
|
66
|
+
},
|
|
67
|
+
"disabled": {
|
|
68
|
+
"$value": "#89888d",
|
|
69
|
+
"$type": "color",
|
|
70
|
+
"$description": "Used for disabled text.",
|
|
71
|
+
"themeable": true
|
|
72
|
+
}
|
|
17
73
|
}
|
|
18
74
|
}
|
|
19
75
|
}
|
|
@@ -2,7 +2,12 @@ import COMPILED_TOKENS from '../../dist/tokens/json/tokens.json';
|
|
|
2
2
|
import { createDesignTokenStory } from './common_story_options';
|
|
3
3
|
|
|
4
4
|
export const Default = createDesignTokenStory({
|
|
5
|
-
tokens:
|
|
5
|
+
tokens: {
|
|
6
|
+
primary: COMPILED_TOKENS.text.primary,
|
|
7
|
+
secondary: COMPILED_TOKENS.text.secondary,
|
|
8
|
+
tertiary: COMPILED_TOKENS.text.tertiary,
|
|
9
|
+
...COMPILED_TOKENS.text.color,
|
|
10
|
+
},
|
|
6
11
|
isBackgroundColorStory: false,
|
|
7
12
|
});
|
|
8
13
|
|
|
@@ -1,12 +1,18 @@
|
|
|
1
1
|
<script>
|
|
2
2
|
import { colorFromBackground } from '../utils/utils';
|
|
3
|
+
import { GlTooltipDirective } from '../directives/tooltip';
|
|
4
|
+
import GlBadge from '../components/base/badge/badge.vue';
|
|
3
5
|
import GlColorContrast from '../internal/color_contrast/color_contrast.vue';
|
|
4
6
|
|
|
5
7
|
export default {
|
|
6
8
|
name: 'TokensStory',
|
|
7
9
|
components: {
|
|
10
|
+
GlBadge,
|
|
8
11
|
GlColorContrast,
|
|
9
12
|
},
|
|
13
|
+
directives: {
|
|
14
|
+
GlTooltip: GlTooltipDirective,
|
|
15
|
+
},
|
|
10
16
|
inject: ['isBackgroundColorStory', 'lightBackground', 'darkBackground', 'containerClass'],
|
|
11
17
|
props: {
|
|
12
18
|
tokens: {
|
|
@@ -53,8 +59,13 @@ export default {
|
|
|
53
59
|
:class="getClasses(token.value)"
|
|
54
60
|
:style="getStyle(token.value)"
|
|
55
61
|
>
|
|
56
|
-
<code class="gl-reset-color">
|
|
62
|
+
<code v-gl-tooltip :title="token.comment" class="gl-reset-color">
|
|
63
|
+
{{ getTokenName(token) }}
|
|
64
|
+
</code>
|
|
57
65
|
<div class="gl-display-flex gl-align-items-center gl-gap-3">
|
|
66
|
+
<gl-badge v-if="token.deprecated" v-gl-tooltip :title="token.comment" variant="danger">
|
|
67
|
+
Deprecated
|
|
68
|
+
</gl-badge>
|
|
58
69
|
<code class="gl-reset-color">{{ token.value }}</code>
|
|
59
70
|
<gl-color-contrast
|
|
60
71
|
v-if="!isAlpha(token.value)"
|
package/src/utils/utils.js
CHANGED
|
@@ -204,3 +204,21 @@ export function stopEvent(
|
|
|
204
204
|
export function filterVisible(els) {
|
|
205
205
|
return (els || []).filter((el) => isVisible(el));
|
|
206
206
|
}
|
|
207
|
+
|
|
208
|
+
/**
|
|
209
|
+
* Given an element, returns a Rect object
|
|
210
|
+
* with top and bottom boundaries removed.
|
|
211
|
+
*/
|
|
212
|
+
export function getHorizontalBoundingClientRect(el) {
|
|
213
|
+
const rect = el?.getBoundingClientRect();
|
|
214
|
+
|
|
215
|
+
if (rect) {
|
|
216
|
+
return {
|
|
217
|
+
x: rect.x,
|
|
218
|
+
width: rect.width,
|
|
219
|
+
y: 0, // top of the document
|
|
220
|
+
height: document.documentElement.clientHeight, // bottom of the document
|
|
221
|
+
};
|
|
222
|
+
}
|
|
223
|
+
return null;
|
|
224
|
+
}
|
package/src/utils/utils.spec.js
CHANGED
|
@@ -3,6 +3,7 @@ import {
|
|
|
3
3
|
isElementTabbable,
|
|
4
4
|
focusFirstFocusableElement,
|
|
5
5
|
stopEvent,
|
|
6
|
+
getHorizontalBoundingClientRect,
|
|
6
7
|
} from './utils';
|
|
7
8
|
|
|
8
9
|
describe('isElementFocusable', () => {
|
|
@@ -153,4 +154,55 @@ describe('stopEvent', () => {
|
|
|
153
154
|
expect(event.stopPropagation).not.toHaveBeenCalled();
|
|
154
155
|
expect(event.stopImmediatePropagation).toHaveBeenCalledTimes(1);
|
|
155
156
|
});
|
|
157
|
+
|
|
158
|
+
describe('getHorizontalBoundingClientRect', () => {
|
|
159
|
+
describe('when there is a reference element', () => {
|
|
160
|
+
let mainElement;
|
|
161
|
+
|
|
162
|
+
const [
|
|
163
|
+
MAIN_LEFT_BOUNDARY,
|
|
164
|
+
MAIN_WIDTH,
|
|
165
|
+
MAIN_TOP_BOUNDARY,
|
|
166
|
+
MAIN_HEIGHT,
|
|
167
|
+
DOCUMENT_TOP_BOUNDARY,
|
|
168
|
+
DOCUMENT_HEIGHT,
|
|
169
|
+
] = [10, 20, 30, 40, 0, 50];
|
|
170
|
+
|
|
171
|
+
beforeEach(() => {
|
|
172
|
+
mainElement = document.createElement('main');
|
|
173
|
+
jest.spyOn(mainElement, 'getBoundingClientRect').mockImplementation(() => {
|
|
174
|
+
return {
|
|
175
|
+
x: MAIN_LEFT_BOUNDARY,
|
|
176
|
+
width: MAIN_WIDTH,
|
|
177
|
+
y: MAIN_TOP_BOUNDARY,
|
|
178
|
+
height: MAIN_HEIGHT,
|
|
179
|
+
};
|
|
180
|
+
});
|
|
181
|
+
Object.defineProperty(document.documentElement, 'clientHeight', {
|
|
182
|
+
get() {
|
|
183
|
+
return DOCUMENT_HEIGHT;
|
|
184
|
+
},
|
|
185
|
+
});
|
|
186
|
+
});
|
|
187
|
+
|
|
188
|
+
afterEach(() => {
|
|
189
|
+
mainElement = null;
|
|
190
|
+
});
|
|
191
|
+
|
|
192
|
+
it("returns the element's horizontal boundaries and the document's vertical boundaries", () => {
|
|
193
|
+
expect(getHorizontalBoundingClientRect(mainElement)).toEqual({
|
|
194
|
+
x: MAIN_LEFT_BOUNDARY,
|
|
195
|
+
width: MAIN_WIDTH,
|
|
196
|
+
y: DOCUMENT_TOP_BOUNDARY,
|
|
197
|
+
height: DOCUMENT_HEIGHT,
|
|
198
|
+
});
|
|
199
|
+
});
|
|
200
|
+
});
|
|
201
|
+
|
|
202
|
+
describe('when there is no reference element', () => {
|
|
203
|
+
it('returns `null`', () => {
|
|
204
|
+
expect(getHorizontalBoundingClientRect(null)).toEqual(null);
|
|
205
|
+
});
|
|
206
|
+
});
|
|
207
|
+
});
|
|
156
208
|
});
|
package/tailwind.defaults.js
CHANGED
|
@@ -26,7 +26,7 @@ const dataVizColors = Object.entries(COMPILED_TOKENS['data-viz']).reduce((acc, [
|
|
|
26
26
|
return acc;
|
|
27
27
|
}, {});
|
|
28
28
|
|
|
29
|
-
const textColors = Object.entries(COMPILED_TOKENS.text).reduce((acc, [scale, token]) => {
|
|
29
|
+
const textColors = Object.entries(COMPILED_TOKENS.text.color).reduce((acc, [scale, token]) => {
|
|
30
30
|
acc[scale] = cssCustomPropertyWithValue(token);
|
|
31
31
|
return acc;
|
|
32
32
|
}, {});
|
|
@@ -40,6 +40,14 @@ const colors = {
|
|
|
40
40
|
...dataVizColors,
|
|
41
41
|
};
|
|
42
42
|
|
|
43
|
+
const textColor = {
|
|
44
|
+
...colors,
|
|
45
|
+
...textColors,
|
|
46
|
+
primary: cssCustomPropertyWithValue(COMPILED_TOKENS.text.primary),
|
|
47
|
+
secondary: cssCustomPropertyWithValue(COMPILED_TOKENS.text.secondary),
|
|
48
|
+
tertiary: cssCustomPropertyWithValue(COMPILED_TOKENS.text.tertiary),
|
|
49
|
+
};
|
|
50
|
+
|
|
43
51
|
const gridSize = 0.5; // rem
|
|
44
52
|
const spacing = {
|
|
45
53
|
0: '0',
|
|
@@ -102,9 +110,6 @@ module.exports = {
|
|
|
102
110
|
semibold: 500,
|
|
103
111
|
bold: 600,
|
|
104
112
|
},
|
|
105
|
-
textColor
|
|
106
|
-
...colors,
|
|
107
|
-
...textColors,
|
|
108
|
-
},
|
|
113
|
+
textColor,
|
|
109
114
|
},
|
|
110
115
|
};
|