@instructure/ui-avatar 9.5.2-snapshot-7 → 9.6.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 CHANGED
@@ -3,17 +3,17 @@
3
3
  All notable changes to this project will be documented in this file.
4
4
  See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
5
5
 
6
- ## [9.5.2-snapshot-7](https://github.com/instructure/instructure-ui/compare/v9.5.1...v9.5.2-snapshot-7) (2024-07-31)
6
+ # [9.6.0](https://github.com/instructure/instructure-ui/compare/v9.5.2...v9.6.0) (2024-08-14)
7
7
 
8
+ **Note:** Version bump only for package @instructure/ui-avatar
8
9
 
9
- ### Features
10
10
 
11
- * **many:** rewrite color system ([1e5809e](https://github.com/instructure/instructure-ui/commit/1e5809e28dee8c2a71703a429609b8d2f95d76e6))
12
11
 
13
12
 
14
- ### BREAKING CHANGES
15
13
 
16
- * **many:** Breaks color overrides in certain cases
14
+ ## [9.5.2](https://github.com/instructure/instructure-ui/compare/v9.5.1...v9.5.2) (2024-08-05)
15
+
16
+ **Note:** Version bump only for package @instructure/ui-avatar
17
17
 
18
18
 
19
19
 
@@ -78,7 +78,7 @@ describe('<Avatar />', () => {
78
78
  name: "Jessica Jones"
79
79
  })));
80
80
  const initials = screen.getByText('JJ');
81
- expect(getComputedStyle(initials).color).toBe('rgb(43, 122, 188)');
81
+ expect(getComputedStyle(initials).color).toBe('rgb(3, 116, 181)');
82
82
  });
83
83
  it('should return the underlying component', async () => {
84
84
  const elementRef = vi.fn();
@@ -194,7 +194,7 @@ describe('<Avatar />', () => {
194
194
  color: "shamrock"
195
195
  })));
196
196
  const initials = screen.getByText('JJ');
197
- expect(getComputedStyle(initials).color).toBe('rgb(3, 137, 61)');
197
+ expect(getComputedStyle(initials).color).toBe('rgb(11, 135, 75)');
198
198
  });
199
199
  it('should display the icon in green (shamrock)', async () => {
200
200
  const _render13 = render(_Avatar13 || (_Avatar13 = /*#__PURE__*/React.createElement(Avatar, {
@@ -205,7 +205,7 @@ describe('<Avatar />', () => {
205
205
  container = _render13.container;
206
206
  const avatarSvg = container.querySelector('svg');
207
207
  expect(avatarSvg).toHaveStyle({
208
- fill: '#CF4A00'
208
+ fill: '#FC5E13'
209
209
  });
210
210
  });
211
211
  });
@@ -219,7 +219,7 @@ describe('<Avatar />', () => {
219
219
  })));
220
220
  const initials = screen.getByText('JJ');
221
221
  expect(initials.parentNode).toHaveStyle({
222
- backgroundColor: 'rgb(3, 137, 61)'
222
+ backgroundColor: 'rgb(11, 135, 75)'
223
223
  });
224
224
  });
225
225
  it('should display the initials in white', async () => {
@@ -245,7 +245,7 @@ describe('<Avatar />', () => {
245
245
  container = _render14.container;
246
246
  const element = container.querySelector('span');
247
247
  expect(element).toHaveStyle({
248
- backgroundColor: 'rgb(3, 137, 61)'
248
+ backgroundColor: 'rgb(11, 135, 75)'
249
249
  });
250
250
  });
251
251
  it('should display the icon in white', async () => {
@@ -29,28 +29,34 @@ import { alpha } from '@instructure/ui-color-utils';
29
29
  * @return {Object} The final theme object with the overrides and component variables
30
30
  */
31
31
  const generateComponentTheme = theme => {
32
- var _colors$contrasts, _colors$contrasts2, _colors$contrasts3, _colors$contrasts4, _colors$contrasts5, _colors$contrasts6, _colors$contrasts7, _colors$contrasts8;
33
32
  const colors = theme.colors,
34
33
  borders = theme.borders,
35
34
  typography = theme.typography;
35
+ const brand = colors.brand,
36
+ shamrock = colors.shamrock,
37
+ barney = colors.barney,
38
+ crimson = colors.crimson,
39
+ fire = colors.fire,
40
+ licorice = colors.licorice,
41
+ ash = colors.ash;
36
42
  const componentVariables = {
37
- background: colors === null || colors === void 0 ? void 0 : (_colors$contrasts = colors.contrasts) === null || _colors$contrasts === void 0 ? void 0 : _colors$contrasts.white1010,
43
+ background: colors === null || colors === void 0 ? void 0 : colors.backgroundLightest,
38
44
  borderWidthSmall: borders === null || borders === void 0 ? void 0 : borders.widthSmall,
39
45
  borderWidthMedium: borders === null || borders === void 0 ? void 0 : borders.widthMedium,
40
- borderColor: colors === null || colors === void 0 ? void 0 : (_colors$contrasts2 = colors.contrasts) === null || _colors$contrasts2 === void 0 ? void 0 : _colors$contrasts2.grey1214,
41
- boxShadowColor: alpha('#2d3b45', 12),
46
+ borderColor: colors === null || colors === void 0 ? void 0 : colors.borderMedium,
47
+ boxShadowColor: alpha(colors === null || colors === void 0 ? void 0 : colors.backgroundDarkest, 12),
42
48
  boxShadowBlur: '1rem',
43
49
  fontFamily: typography === null || typography === void 0 ? void 0 : typography.fontFamily,
44
50
  fontWeight: typography === null || typography === void 0 ? void 0 : typography.fontWeightBold,
45
51
  // these colors have sufficient contrast with the white background
46
52
  // in the normal and high contrast themes
47
- color: colors === null || colors === void 0 ? void 0 : colors.contrasts.blue4570,
48
- colorShamrock: colors === null || colors === void 0 ? void 0 : (_colors$contrasts3 = colors.contrasts) === null || _colors$contrasts3 === void 0 ? void 0 : _colors$contrasts3.green4570,
49
- colorBarney: colors === null || colors === void 0 ? void 0 : (_colors$contrasts4 = colors.contrasts) === null || _colors$contrasts4 === void 0 ? void 0 : _colors$contrasts4.blue4570,
50
- colorCrimson: colors === null || colors === void 0 ? void 0 : (_colors$contrasts5 = colors.contrasts) === null || _colors$contrasts5 === void 0 ? void 0 : _colors$contrasts5.red4570,
51
- colorFire: colors === null || colors === void 0 ? void 0 : (_colors$contrasts6 = colors.contrasts) === null || _colors$contrasts6 === void 0 ? void 0 : _colors$contrasts6.orange4570,
52
- colorLicorice: colors === null || colors === void 0 ? void 0 : (_colors$contrasts7 = colors.contrasts) === null || _colors$contrasts7 === void 0 ? void 0 : _colors$contrasts7.grey125125,
53
- colorAsh: colors === null || colors === void 0 ? void 0 : (_colors$contrasts8 = colors.contrasts) === null || _colors$contrasts8 === void 0 ? void 0 : _colors$contrasts8.grey4570
53
+ color: brand,
54
+ colorShamrock: shamrock,
55
+ colorBarney: barney,
56
+ colorCrimson: crimson,
57
+ colorFire: fire,
58
+ colorLicorice: licorice,
59
+ colorAsh: ash
54
60
  };
55
61
  return {
56
62
  ...componentVariables
@@ -81,7 +81,7 @@ describe('<Avatar />', () => {
81
81
  name: "Jessica Jones"
82
82
  })));
83
83
  const initials = _react2.screen.getByText('JJ');
84
- expect(getComputedStyle(initials).color).toBe('rgb(43, 122, 188)');
84
+ expect(getComputedStyle(initials).color).toBe('rgb(3, 116, 181)');
85
85
  });
86
86
  it('should return the underlying component', async () => {
87
87
  const elementRef = _vitest.vi.fn();
@@ -197,7 +197,7 @@ describe('<Avatar />', () => {
197
197
  color: "shamrock"
198
198
  })));
199
199
  const initials = _react2.screen.getByText('JJ');
200
- expect(getComputedStyle(initials).color).toBe('rgb(3, 137, 61)');
200
+ expect(getComputedStyle(initials).color).toBe('rgb(11, 135, 75)');
201
201
  });
202
202
  it('should display the icon in green (shamrock)', async () => {
203
203
  const _render13 = (0, _react2.render)(_Avatar13 || (_Avatar13 = /*#__PURE__*/_react.default.createElement(_index.default, {
@@ -208,7 +208,7 @@ describe('<Avatar />', () => {
208
208
  container = _render13.container;
209
209
  const avatarSvg = container.querySelector('svg');
210
210
  expect(avatarSvg).toHaveStyle({
211
- fill: '#CF4A00'
211
+ fill: '#FC5E13'
212
212
  });
213
213
  });
214
214
  });
@@ -222,7 +222,7 @@ describe('<Avatar />', () => {
222
222
  })));
223
223
  const initials = _react2.screen.getByText('JJ');
224
224
  expect(initials.parentNode).toHaveStyle({
225
- backgroundColor: 'rgb(3, 137, 61)'
225
+ backgroundColor: 'rgb(11, 135, 75)'
226
226
  });
227
227
  });
228
228
  it('should display the initials in white', async () => {
@@ -248,7 +248,7 @@ describe('<Avatar />', () => {
248
248
  container = _render14.container;
249
249
  const element = container.querySelector('span');
250
250
  expect(element).toHaveStyle({
251
- backgroundColor: 'rgb(3, 137, 61)'
251
+ backgroundColor: 'rgb(11, 135, 75)'
252
252
  });
253
253
  });
254
254
  it('should display the icon in white', async () => {
@@ -35,28 +35,34 @@ var _alpha = require("@instructure/ui-color-utils/lib/alpha.js");
35
35
  * @return {Object} The final theme object with the overrides and component variables
36
36
  */
37
37
  const generateComponentTheme = theme => {
38
- var _colors$contrasts, _colors$contrasts2, _colors$contrasts3, _colors$contrasts4, _colors$contrasts5, _colors$contrasts6, _colors$contrasts7, _colors$contrasts8;
39
38
  const colors = theme.colors,
40
39
  borders = theme.borders,
41
40
  typography = theme.typography;
41
+ const brand = colors.brand,
42
+ shamrock = colors.shamrock,
43
+ barney = colors.barney,
44
+ crimson = colors.crimson,
45
+ fire = colors.fire,
46
+ licorice = colors.licorice,
47
+ ash = colors.ash;
42
48
  const componentVariables = {
43
- background: colors === null || colors === void 0 ? void 0 : (_colors$contrasts = colors.contrasts) === null || _colors$contrasts === void 0 ? void 0 : _colors$contrasts.white1010,
49
+ background: colors === null || colors === void 0 ? void 0 : colors.backgroundLightest,
44
50
  borderWidthSmall: borders === null || borders === void 0 ? void 0 : borders.widthSmall,
45
51
  borderWidthMedium: borders === null || borders === void 0 ? void 0 : borders.widthMedium,
46
- borderColor: colors === null || colors === void 0 ? void 0 : (_colors$contrasts2 = colors.contrasts) === null || _colors$contrasts2 === void 0 ? void 0 : _colors$contrasts2.grey1214,
47
- boxShadowColor: (0, _alpha.alpha)('#2d3b45', 12),
52
+ borderColor: colors === null || colors === void 0 ? void 0 : colors.borderMedium,
53
+ boxShadowColor: (0, _alpha.alpha)(colors === null || colors === void 0 ? void 0 : colors.backgroundDarkest, 12),
48
54
  boxShadowBlur: '1rem',
49
55
  fontFamily: typography === null || typography === void 0 ? void 0 : typography.fontFamily,
50
56
  fontWeight: typography === null || typography === void 0 ? void 0 : typography.fontWeightBold,
51
57
  // these colors have sufficient contrast with the white background
52
58
  // in the normal and high contrast themes
53
- color: colors === null || colors === void 0 ? void 0 : colors.contrasts.blue4570,
54
- colorShamrock: colors === null || colors === void 0 ? void 0 : (_colors$contrasts3 = colors.contrasts) === null || _colors$contrasts3 === void 0 ? void 0 : _colors$contrasts3.green4570,
55
- colorBarney: colors === null || colors === void 0 ? void 0 : (_colors$contrasts4 = colors.contrasts) === null || _colors$contrasts4 === void 0 ? void 0 : _colors$contrasts4.blue4570,
56
- colorCrimson: colors === null || colors === void 0 ? void 0 : (_colors$contrasts5 = colors.contrasts) === null || _colors$contrasts5 === void 0 ? void 0 : _colors$contrasts5.red4570,
57
- colorFire: colors === null || colors === void 0 ? void 0 : (_colors$contrasts6 = colors.contrasts) === null || _colors$contrasts6 === void 0 ? void 0 : _colors$contrasts6.orange4570,
58
- colorLicorice: colors === null || colors === void 0 ? void 0 : (_colors$contrasts7 = colors.contrasts) === null || _colors$contrasts7 === void 0 ? void 0 : _colors$contrasts7.grey125125,
59
- colorAsh: colors === null || colors === void 0 ? void 0 : (_colors$contrasts8 = colors.contrasts) === null || _colors$contrasts8 === void 0 ? void 0 : _colors$contrasts8.grey4570
59
+ color: brand,
60
+ colorShamrock: shamrock,
61
+ colorBarney: barney,
62
+ colorCrimson: crimson,
63
+ colorFire: fire,
64
+ colorLicorice: licorice,
65
+ colorAsh: ash
60
66
  };
61
67
  return {
62
68
  ...componentVariables
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@instructure/ui-avatar",
3
- "version": "9.5.2-snapshot-7",
3
+ "version": "9.6.0",
4
4
  "description": "An image or letters that represents a user.",
5
5
  "author": "Instructure, Inc. Engineering and Product Design",
6
6
  "module": "./es/index.js",
@@ -24,21 +24,21 @@
24
24
  "license": "MIT",
25
25
  "dependencies": {
26
26
  "@babel/runtime": "^7.24.5",
27
- "@instructure/emotion": "9.5.2-snapshot-7",
28
- "@instructure/shared-types": "9.5.2-snapshot-7",
29
- "@instructure/ui-icons": "9.5.2-snapshot-7",
30
- "@instructure/ui-react-utils": "9.5.2-snapshot-7",
31
- "@instructure/ui-testable": "9.5.2-snapshot-7",
32
- "@instructure/ui-view": "9.5.2-snapshot-7",
27
+ "@instructure/emotion": "9.6.0",
28
+ "@instructure/shared-types": "9.6.0",
29
+ "@instructure/ui-icons": "9.6.0",
30
+ "@instructure/ui-react-utils": "9.6.0",
31
+ "@instructure/ui-testable": "9.6.0",
32
+ "@instructure/ui-view": "9.6.0",
33
33
  "prop-types": "^15.8.1"
34
34
  },
35
35
  "devDependencies": {
36
- "@instructure/ui-axe-check": "9.5.2-snapshot-7",
37
- "@instructure/ui-babel-preset": "9.5.2-snapshot-7",
38
- "@instructure/ui-color-utils": "9.5.2-snapshot-7",
39
- "@instructure/ui-test-locator": "9.5.2-snapshot-7",
40
- "@instructure/ui-test-utils": "9.5.2-snapshot-7",
41
- "@instructure/ui-themes": "9.5.2-snapshot-7",
36
+ "@instructure/ui-axe-check": "9.6.0",
37
+ "@instructure/ui-babel-preset": "9.6.0",
38
+ "@instructure/ui-color-utils": "9.6.0",
39
+ "@instructure/ui-test-locator": "9.6.0",
40
+ "@instructure/ui-test-utils": "9.6.0",
41
+ "@instructure/ui-themes": "9.6.0",
42
42
  "@testing-library/jest-dom": "^6.4.6",
43
43
  "@testing-library/react": "^15.0.7",
44
44
  "vitest": "^2.0.2"
@@ -69,7 +69,7 @@ describe('<Avatar />', () => {
69
69
  it('should display the initials in brand color', async () => {
70
70
  render(<Avatar name="Jessica Jones" />)
71
71
  const initials = screen.getByText('JJ')
72
- expect(getComputedStyle(initials).color).toBe('rgb(43, 122, 188)')
72
+ expect(getComputedStyle(initials).color).toBe('rgb(3, 116, 181)')
73
73
  })
74
74
 
75
75
  it('should return the underlying component', async () => {
@@ -176,7 +176,7 @@ describe('<Avatar />', () => {
176
176
  it('should display the initials in green (shamrock)', async () => {
177
177
  render(<Avatar name="Jessica Jones" color="shamrock" />)
178
178
  const initials = screen.getByText('JJ')
179
- expect(getComputedStyle(initials).color).toBe('rgb(3, 137, 61)')
179
+ expect(getComputedStyle(initials).color).toBe('rgb(11, 135, 75)')
180
180
  })
181
181
 
182
182
  it('should display the icon in green (shamrock)', async () => {
@@ -190,7 +190,7 @@ describe('<Avatar />', () => {
190
190
  </Avatar>
191
191
  )
192
192
  const avatarSvg = container.querySelector('svg')
193
- expect(avatarSvg).toHaveStyle({ fill: '#CF4A00' })
193
+ expect(avatarSvg).toHaveStyle({ fill: '#FC5E13' })
194
194
  })
195
195
  })
196
196
 
@@ -200,7 +200,7 @@ describe('<Avatar />', () => {
200
200
  render(<Avatar name="Jessica Jones" color="shamrock" hasInverseColor />)
201
201
  const initials = screen.getByText('JJ')
202
202
  expect(initials.parentNode).toHaveStyle({
203
- backgroundColor: 'rgb(3, 137, 61)'
203
+ backgroundColor: 'rgb(11, 135, 75)'
204
204
  })
205
205
  })
206
206
 
@@ -222,7 +222,7 @@ describe('<Avatar />', () => {
222
222
  />
223
223
  )
224
224
  const element = container.querySelector('span')
225
- expect(element).toHaveStyle({ backgroundColor: 'rgb(3, 137, 61)' })
225
+ expect(element).toHaveStyle({ backgroundColor: 'rgb(11, 135, 75)' })
226
226
  })
227
227
 
228
228
  it('should display the icon in white', async () => {
@@ -34,25 +34,27 @@ import { AvatarTheme } from '@instructure/shared-types'
34
34
  const generateComponentTheme = (theme: Theme): AvatarTheme => {
35
35
  const { colors, borders, typography } = theme
36
36
 
37
+ const { brand, shamrock, barney, crimson, fire, licorice, ash } = colors
38
+
37
39
  const componentVariables: AvatarTheme = {
38
- background: colors?.contrasts?.white1010,
40
+ background: colors?.backgroundLightest,
39
41
  borderWidthSmall: borders?.widthSmall,
40
42
  borderWidthMedium: borders?.widthMedium,
41
- borderColor: colors?.contrasts?.grey1214,
42
- boxShadowColor: alpha('#2d3b45', 12),
43
+ borderColor: colors?.borderMedium,
44
+ boxShadowColor: alpha(colors?.backgroundDarkest, 12),
43
45
  boxShadowBlur: '1rem',
44
46
  fontFamily: typography?.fontFamily,
45
47
  fontWeight: typography?.fontWeightBold,
46
48
 
47
49
  // these colors have sufficient contrast with the white background
48
50
  // in the normal and high contrast themes
49
- color: colors?.contrasts.blue4570,
50
- colorShamrock: colors?.contrasts?.green4570,
51
- colorBarney: colors?.contrasts?.blue4570,
52
- colorCrimson: colors?.contrasts?.red4570,
53
- colorFire: colors?.contrasts?.orange4570,
54
- colorLicorice: colors?.contrasts?.grey125125,
55
- colorAsh: colors?.contrasts?.grey4570
51
+ color: brand,
52
+ colorShamrock: shamrock,
53
+ colorBarney: barney,
54
+ colorCrimson: crimson,
55
+ colorFire: fire,
56
+ colorLicorice: licorice,
57
+ colorAsh: ash
56
58
  }
57
59
 
58
60
  return {