@gitlab/ui 73.1.0 → 73.1.1
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 +7 -0
- package/dist/components/base/badge/badge.js +3 -0
- package/dist/tokens/css/tokens.css +1 -1
- package/dist/tokens/css/tokens.dark.css +1 -1
- package/dist/tokens/js/tokens.dark.js +1 -1
- package/dist/tokens/js/tokens.js +1 -1
- package/dist/tokens/scss/_tokens.dark.scss +1 -1
- package/dist/tokens/scss/_tokens.scss +1 -1
- package/package.json +1 -1
- package/src/components/base/badge/badge.spec.js +37 -26
- package/src/components/base/badge/badge.vue +4 -0
- package/tailwind.defaults.js +4 -4
package/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,10 @@
|
|
|
1
|
+
## [73.1.1](https://gitlab.com/gitlab-org/gitlab-ui/compare/v73.1.0...v73.1.1) (2024-02-01)
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
### Bug Fixes
|
|
5
|
+
|
|
6
|
+
* **GlBadge:** Pass aria label through if any ([5f3d8ec](https://gitlab.com/gitlab-org/gitlab-ui/commit/5f3d8ec5a09bc0963ea3282da758ba3c7469935c))
|
|
7
|
+
|
|
1
8
|
# [73.1.0](https://gitlab.com/gitlab-org/gitlab-ui/compare/v73.0.1...v73.1.0) (2024-01-31)
|
|
2
9
|
|
|
3
10
|
|
package/dist/tokens/js/tokens.js
CHANGED
package/package.json
CHANGED
|
@@ -17,44 +17,51 @@ describe('badge', () => {
|
|
|
17
17
|
|
|
18
18
|
describe('with "icon" prop', () => {
|
|
19
19
|
describe.each`
|
|
20
|
-
scenario | hasSlot | iconName | iconSize | expectedIconSize | expectedRole
|
|
21
|
-
${'icon-only'} | ${false} | ${'warning'} | ${'md'} | ${16} | ${'img'}
|
|
22
|
-
${'16px icon and slot'} | ${true} | ${'warning'} | ${'md'} | ${16} | ${undefined}
|
|
23
|
-
${'12px icon and slot'} | ${true} | ${'warning'} | ${'sm'} | ${12} | ${undefined}
|
|
24
|
-
`(
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
expect(wrapper.attributes('role')).toBe(expectedRole);
|
|
32
|
-
});
|
|
20
|
+
scenario | hasSlot | iconName | iconSize | expectedIconSize | expectedRole | expectedAriaLabel
|
|
21
|
+
${'icon-only'} | ${false} | ${'warning'} | ${'md'} | ${16} | ${'img'} | ${'warning'}
|
|
22
|
+
${'16px icon and slot'} | ${true} | ${'warning'} | ${'md'} | ${16} | ${undefined} | ${undefined}
|
|
23
|
+
${'12px icon and slot'} | ${true} | ${'warning'} | ${'sm'} | ${12} | ${undefined} | ${undefined}
|
|
24
|
+
`(
|
|
25
|
+
'with $scenario',
|
|
26
|
+
({ iconName, iconSize, expectedIconSize, hasSlot, expectedRole, expectedAriaLabel }) => {
|
|
27
|
+
beforeEach(() => {
|
|
28
|
+
const slots = hasSlot ? { default: 'slot-content' } : undefined;
|
|
29
|
+
createComponent({ propsData: { icon: iconName, iconSize }, slots });
|
|
30
|
+
});
|
|
33
31
|
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
const icon = findIcon();
|
|
37
|
-
expect(icon.exists()).toBe(true);
|
|
38
|
-
expect(icon.props('name')).toBe(iconName);
|
|
32
|
+
it(`sets badge "role" attribute to ${expectedRole}`, () => {
|
|
33
|
+
expect(wrapper.attributes('role')).toBe(expectedRole);
|
|
39
34
|
});
|
|
40
35
|
|
|
41
|
-
|
|
42
|
-
|
|
36
|
+
describe('renders icon', () => {
|
|
37
|
+
it('with correct props', () => {
|
|
38
|
+
const icon = findIcon();
|
|
39
|
+
expect(icon.exists()).toBe(true);
|
|
40
|
+
expect(icon.props('name')).toBe(iconName);
|
|
41
|
+
});
|
|
42
|
+
|
|
43
|
+
it('with correct class', () => {
|
|
44
|
+
const icon = findIcon();
|
|
45
|
+
|
|
46
|
+
expect(icon.classes('gl-mr-2')).toBe(hasSlot);
|
|
47
|
+
});
|
|
43
48
|
|
|
44
|
-
|
|
49
|
+
it('with correct size', () => {
|
|
50
|
+
expect(findIcon().props('size')).toBe(expectedIconSize);
|
|
51
|
+
});
|
|
45
52
|
});
|
|
46
53
|
|
|
47
|
-
it('
|
|
48
|
-
expect(
|
|
54
|
+
it('sets aria-label', () => {
|
|
55
|
+
expect(wrapper.attributes('aria-label')).toBe(expectedAriaLabel);
|
|
49
56
|
});
|
|
50
|
-
}
|
|
51
|
-
|
|
57
|
+
}
|
|
58
|
+
);
|
|
52
59
|
});
|
|
53
60
|
|
|
54
61
|
describe('without "icon" prop', () => {
|
|
55
62
|
const mockSlotContent = 'slot-content';
|
|
56
63
|
beforeEach(() => {
|
|
57
|
-
createComponent({ slots: { default: mockSlotContent } });
|
|
64
|
+
createComponent({ slots: { default: mockSlotContent }, attrs: { 'aria-label': 'Success' } });
|
|
58
65
|
});
|
|
59
66
|
|
|
60
67
|
it('renders slot content', () => {
|
|
@@ -68,5 +75,9 @@ describe('badge', () => {
|
|
|
68
75
|
it('sets badge "role" attribute to undefined', () => {
|
|
69
76
|
expect(wrapper.attributes('role')).toBe(undefined);
|
|
70
77
|
});
|
|
78
|
+
|
|
79
|
+
it('sets aria-label', () => {
|
|
80
|
+
expect(wrapper.attributes('aria-label')).toBe('Success');
|
|
81
|
+
});
|
|
71
82
|
});
|
|
72
83
|
});
|
package/tailwind.defaults.js
CHANGED
|
@@ -4,7 +4,7 @@ const themeColorTokens = require('./src/tokens/color.theme.tokens.json');
|
|
|
4
4
|
const baseColors = ['blue', 'gray', 'green', 'orange', 'purple', 'red'].reduce((acc, color) => {
|
|
5
5
|
acc[color] = {};
|
|
6
6
|
Object.entries(baseColorTokens[color]).forEach(([shade, { $value }]) => {
|
|
7
|
-
acc[color][shade] = $value
|
|
7
|
+
acc[color][shade] = `var(--${color}-${shade}, ${$value})`;
|
|
8
8
|
});
|
|
9
9
|
return acc;
|
|
10
10
|
}, {});
|
|
@@ -13,7 +13,7 @@ const themeColors = Object.entries(themeColorTokens.theme).reduce((acc, [color,
|
|
|
13
13
|
const colorKey = `theme-${color}`;
|
|
14
14
|
acc[colorKey] = {};
|
|
15
15
|
Object.entries(shades).forEach(([shade, { $value }]) => {
|
|
16
|
-
acc[colorKey][shade] = $value
|
|
16
|
+
acc[colorKey][shade] = `var(--${colorKey}-${shade}, ${$value})`;
|
|
17
17
|
});
|
|
18
18
|
return acc;
|
|
19
19
|
}, {});
|
|
@@ -58,8 +58,8 @@ module.exports = {
|
|
|
58
58
|
prefix: 'gl-',
|
|
59
59
|
theme: {
|
|
60
60
|
colors: {
|
|
61
|
-
white: baseColorTokens.white.$value
|
|
62
|
-
black: baseColorTokens.black.$value
|
|
61
|
+
white: `var(--white, ${baseColorTokens.white.$value})`,
|
|
62
|
+
black: `var(--black, ${baseColorTokens.black.$value})`,
|
|
63
63
|
...baseColors,
|
|
64
64
|
...themeColors,
|
|
65
65
|
},
|