@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 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
 
@@ -61,6 +61,9 @@ var script = {
61
61
  return this.hasIconOnly ? 'img' : undefined;
62
62
  },
63
63
  ariaLabel() {
64
+ if (this.$attrs['aria-label']) {
65
+ return this.$attrs['aria-label'];
66
+ }
64
67
  return this.role === 'img' ? this.icon : undefined;
65
68
  },
66
69
  iconSizeComputed() {
@@ -1,6 +1,6 @@
1
1
  /**
2
2
  * Do not edit directly
3
- * Generated on Wed, 31 Jan 2024 08:13:00 GMT
3
+ * Generated on Thu, 01 Feb 2024 16:57:13 GMT
4
4
  */
5
5
 
6
6
  :root {
@@ -1,6 +1,6 @@
1
1
  /**
2
2
  * Do not edit directly
3
- * Generated on Wed, 31 Jan 2024 08:13:00 GMT
3
+ * Generated on Thu, 01 Feb 2024 16:57:13 GMT
4
4
  */
5
5
 
6
6
  :root.gl-dark {
@@ -1,6 +1,6 @@
1
1
  /**
2
2
  * Do not edit directly
3
- * Generated on Wed, 31 Jan 2024 08:13:00 GMT
3
+ * Generated on Thu, 01 Feb 2024 16:57:13 GMT
4
4
  */
5
5
 
6
6
  export const DATA_VIZ_GREEN_50 = "#133a03";
@@ -1,6 +1,6 @@
1
1
  /**
2
2
  * Do not edit directly
3
- * Generated on Wed, 31 Jan 2024 08:13:00 GMT
3
+ * Generated on Thu, 01 Feb 2024 16:57:13 GMT
4
4
  */
5
5
 
6
6
  export const DATA_VIZ_GREEN_50 = "#ddfab7";
@@ -1,6 +1,6 @@
1
1
 
2
2
  // Do not edit directly
3
- // Generated on Wed, 31 Jan 2024 08:13:00 GMT
3
+ // Generated on Thu, 01 Feb 2024 16:57:13 GMT
4
4
 
5
5
  $red-950: #fff4f3;
6
6
  $red-900: #fcf1ef;
@@ -1,6 +1,6 @@
1
1
 
2
2
  // Do not edit directly
3
- // Generated on Wed, 31 Jan 2024 08:13:00 GMT
3
+ // Generated on Thu, 01 Feb 2024 16:57:13 GMT
4
4
 
5
5
  $gl-line-height-52: 3.25rem;
6
6
  $gl-line-height-44: 2.75rem;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@gitlab/ui",
3
- "version": "73.1.0",
3
+ "version": "73.1.1",
4
4
  "description": "GitLab UI Components",
5
5
  "license": "MIT",
6
6
  "main": "dist/index.js",
@@ -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
- `('with $scenario', ({ iconName, iconSize, expectedIconSize, hasSlot, expectedRole }) => {
25
- beforeEach(() => {
26
- const slots = hasSlot ? { default: 'slot-content' } : undefined;
27
- createComponent({ propsData: { icon: iconName, iconSize }, slots });
28
- });
29
-
30
- it(`sets badge "role" attribute to ${expectedRole}`, () => {
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
- describe('renders icon', () => {
35
- it('with correct props', () => {
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
- it('with correct class', () => {
42
- const icon = findIcon();
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
- expect(icon.classes('gl-mr-2')).toBe(hasSlot);
49
+ it('with correct size', () => {
50
+ expect(findIcon().props('size')).toBe(expectedIconSize);
51
+ });
45
52
  });
46
53
 
47
- it('with correct size', () => {
48
- expect(findIcon().props('size')).toBe(expectedIconSize);
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
  });
@@ -65,6 +65,10 @@ export default {
65
65
  return this.hasIconOnly ? 'img' : undefined;
66
66
  },
67
67
  ariaLabel() {
68
+ if (this.$attrs['aria-label']) {
69
+ return this.$attrs['aria-label'];
70
+ }
71
+
68
72
  return this.role === 'img' ? this.icon : undefined;
69
73
  },
70
74
  iconSizeComputed() {
@@ -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
  },