@zendeskgarden/react-avatars 9.7.2 → 9.8.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.
@@ -36,16 +36,17 @@ const StatusIndicator = forwardRef((_ref, ref) => {
36
36
  const defaultLabel = useMemo(() => ['status'].concat(type || []).join(': '), [type]);
37
37
  const ariaLabel = useText(StatusIndicator, {
38
38
  'aria-label': label
39
- }, 'aria-label', defaultLabel);
39
+ }, 'aria-label', defaultLabel, label !== null);
40
40
  return (
41
41
  React__default.createElement(StyledStandaloneStatus, Object.assign({
42
42
  role: "status",
43
43
  ref: ref
44
44
  }, props), React__default.createElement(StyledStandaloneStatusIndicator, {
45
+ "aria-hidden": label === null ? true : undefined,
46
+ "aria-label": ariaLabel,
45
47
  role: "img",
46
48
  $type: type,
47
- $size: isCompact ? 'small' : 'medium',
48
- "aria-label": ariaLabel
49
+ $size: isCompact ? 'small' : 'medium'
49
50
  }, type === 'away' ? React__default.createElement(ClockIcon, {
50
51
  "data-icon-status": type,
51
52
  "aria-hidden": "true"
@@ -57,6 +58,7 @@ const StatusIndicator = forwardRef((_ref, ref) => {
57
58
  });
58
59
  StatusIndicator.displayName = 'StatusIndicator';
59
60
  StatusIndicator.propTypes = {
61
+ 'aria-label': PropTypes.string,
60
62
  type: PropTypes.oneOf(STATUS),
61
63
  isCompact: PropTypes.bool
62
64
  };
@@ -108,7 +108,7 @@ const sizeStyles = props => {
108
108
  };
109
109
  const StyledAvatar = styled.figure.attrs({
110
110
  'data-garden-id': COMPONENT_ID,
111
- 'data-garden-version': '9.7.2'
111
+ 'data-garden-version': '9.8.0'
112
112
  }).withConfig({
113
113
  displayName: "StyledAvatar",
114
114
  componentId: "sc-608m04-0"
@@ -11,7 +11,7 @@ import { TRANSITION_DURATION } from './utility.js';
11
11
  const COMPONENT_ID = 'avatars.status-indicator.status';
12
12
  const StyledStandaloneStatus = styled.figure.attrs({
13
13
  'data-garden-id': COMPONENT_ID,
14
- 'data-garden-version': '9.7.2'
14
+ 'data-garden-version': '9.8.0'
15
15
  }).withConfig({
16
16
  displayName: "StyledStandaloneStatus",
17
17
  componentId: "sc-1ow4nfj-0"
@@ -14,7 +14,7 @@ function sizeStyles(props) {
14
14
  }
15
15
  const StyledStandaloneStatusCaption = styled.figcaption.attrs({
16
16
  'data-garden-id': COMPONENT_ID,
17
- 'data-garden-version': '9.7.2'
17
+ 'data-garden-version': '9.8.0'
18
18
  }).withConfig({
19
19
  displayName: "StyledStandaloneStatusCaption",
20
20
  componentId: "sc-aalyk1-0"
@@ -12,7 +12,7 @@ import { StyledStatusIndicatorBase } from './StyledStatusIndicatorBase.js';
12
12
  const COMPONENT_ID = 'avatars.status-indicator.indicator';
13
13
  const StyledStandaloneStatusIndicator = styled(StyledStatusIndicatorBase).attrs({
14
14
  'data-garden-id': COMPONENT_ID,
15
- 'data-garden-version': '9.7.2'
15
+ 'data-garden-version': '9.8.0'
16
16
  }).withConfig({
17
17
  displayName: "StyledStandaloneStatusIndicator",
18
18
  componentId: "sc-1xt1heq-0"
@@ -9,12 +9,13 @@ import { componentStyles, DEFAULT_THEME, getColor } from '@zendeskgarden/react-t
9
9
  import { math } from 'polished';
10
10
  import { SIZE } from '../types/index.js';
11
11
  import { StyledStatusIndicatorBase } from './StyledStatusIndicatorBase.js';
12
- import { includes, getStatusBorderOffset } from './utility.js';
12
+ import { getStatusBorderOffset, includes } from './utility.js';
13
13
 
14
14
  const COMPONENT_ID = 'avatars.status_indicator';
15
15
  const [xxs, xs, s, m, l] = SIZE;
16
16
  const sizeStyles = props => {
17
- const isVisible = !includes([xxs, xs], props.$size);
17
+ const isVisible = props.$size !== xxs;
18
+ const iconSize = props.$size === xs ? `${props.theme.space.base * 2}px` : undefined;
18
19
  const borderWidth = getStatusBorderOffset(props);
19
20
  let padding = '0';
20
21
  if (props.$size === s) {
@@ -22,7 +23,7 @@ const sizeStyles = props => {
22
23
  } else if (includes([m, l], props.$size)) {
23
24
  padding = math(`${props.theme.space.base + 3}px - (${borderWidth} * 2)`);
24
25
  }
25
- return css(["max-width:calc(2em + (", " * 3));box-sizing:content-box;overflow:hidden;text-align:center;text-overflow:ellipsis;white-space:nowrap;font-size:", ";font-weight:", ";& > span{display:", ";padding:0 ", ";max-width:2em;overflow:inherit;text-align:inherit;text-overflow:inherit;white-space:inherit;}& > svg{", "}"], borderWidth, props.theme.fontSizes.xs, props.theme.fontWeights.semibold, isVisible ? 'inline-block' : 'none', padding, !isVisible && 'display: none;');
26
+ return css(["max-width:calc(2em + (", " * 3));box-sizing:content-box;overflow:hidden;text-align:center;text-overflow:ellipsis;white-space:nowrap;font-size:", ";font-weight:", ";& > span{display:", ";padding:0 ", ";max-width:2em;overflow:inherit;text-align:inherit;text-overflow:inherit;white-space:inherit;}& > svg{", " width:", ";height:", ";}"], borderWidth, props.theme.fontSizes.xs, props.theme.fontWeights.semibold, isVisible ? 'inline-block' : 'none', padding, !isVisible && 'display: none;', iconSize, iconSize);
26
27
  };
27
28
  const colorStyles = _ref => {
28
29
  let {
@@ -50,7 +51,7 @@ const colorStyles = _ref => {
50
51
  };
51
52
  const StyledStatusIndicator = styled(StyledStatusIndicatorBase).attrs({
52
53
  'data-garden-id': COMPONENT_ID,
53
- 'data-garden-version': '9.7.2'
54
+ 'data-garden-version': '9.8.0'
54
55
  }).withConfig({
55
56
  displayName: "StyledStatusIndicator",
56
57
  componentId: "sc-16t9if3-0"
@@ -13,7 +13,7 @@ const iconFadeIn = keyframes(["0%{opacity:0;}100%{opacity:1;}"]);
13
13
  const sizeStyles = props => {
14
14
  const offset = getStatusBorderOffset(props);
15
15
  const size = getStatusSize(props, offset);
16
- return css(["border:", " ", ";border-radius:", ";min-width:", ";height:", ";line-height:", ";& > svg{position:absolute;top:-", ";left:-", ";transform-origin:50% 50%;animation:", " ", "s;max-height:unset;&[data-icon-status='transfers']{transform:scale(", ",1);}&[data-icon-status='away'] circle{display:none;}}"], offset, props.theme.borderStyles.solid, size, size, size, size, offset, offset, iconFadeIn, TRANSITION_DURATION, props.theme.rtl ? -1 : 1);
16
+ return css(["border:", " ", ";border-radius:", ";min-width:", ";height:", ";line-height:", ";& > svg{position:absolute;top:-", ";inset-inline-start:-", ";transform-origin:50% 50%;animation:", " ", "s;max-height:unset;&[data-icon-status='transfers']{transform:scale(", ",1);inset-inline-start:", ";}&[data-icon-status='away'] circle{display:none;}}"], offset, props.theme.borderStyles.solid, size, size, size, size, offset, offset, iconFadeIn, TRANSITION_DURATION, props.theme.rtl ? -1 : 1, props.$size === 'extrasmall' ? '-1px' : undefined);
17
17
  };
18
18
  const colorStyles = _ref => {
19
19
  let {
@@ -40,7 +40,7 @@ const colorStyles = _ref => {
40
40
  };
41
41
  const StyledStatusIndicatorBase = styled.div.attrs({
42
42
  'data-garden-id': COMPONENT_ID,
43
- 'data-garden-version': '9.7.2'
43
+ 'data-garden-version': '9.8.0'
44
44
  }).withConfig({
45
45
  displayName: "StyledStatusIndicatorBase",
46
46
  componentId: "sc-1rininy-0"
@@ -10,7 +10,7 @@ import { componentStyles } from '@zendeskgarden/react-theming';
10
10
  const COMPONENT_ID = 'avatars.text';
11
11
  const StyledText = styled.span.attrs({
12
12
  'data-garden-id': COMPONENT_ID,
13
- 'data-garden-version': '9.7.2'
13
+ 'data-garden-version': '9.8.0'
14
14
  }).withConfig({
15
15
  displayName: "StyledText",
16
16
  componentId: "sc-1a6hivh-0"
package/dist/index.cjs.js CHANGED
@@ -123,7 +123,7 @@ const STATUS = ['available', 'away', 'transfers', 'offline'];
123
123
  const COMPONENT_ID$6 = 'avatars.text';
124
124
  const StyledText = styled__default.default.span.attrs({
125
125
  'data-garden-id': COMPONENT_ID$6,
126
- 'data-garden-version': '9.7.2'
126
+ 'data-garden-version': '9.8.0'
127
127
  }).withConfig({
128
128
  displayName: "StyledText",
129
129
  componentId: "sc-1a6hivh-0"
@@ -216,7 +216,7 @@ const iconFadeIn = styled.keyframes(["0%{opacity:0;}100%{opacity:1;}"]);
216
216
  const sizeStyles$3 = props => {
217
217
  const offset = getStatusBorderOffset(props);
218
218
  const size = getStatusSize(props, offset);
219
- return styled.css(["border:", " ", ";border-radius:", ";min-width:", ";height:", ";line-height:", ";& > svg{position:absolute;top:-", ";left:-", ";transform-origin:50% 50%;animation:", " ", "s;max-height:unset;&[data-icon-status='transfers']{transform:scale(", ",1);}&[data-icon-status='away'] circle{display:none;}}"], offset, props.theme.borderStyles.solid, size, size, size, size, offset, offset, iconFadeIn, TRANSITION_DURATION, props.theme.rtl ? -1 : 1);
219
+ return styled.css(["border:", " ", ";border-radius:", ";min-width:", ";height:", ";line-height:", ";& > svg{position:absolute;top:-", ";inset-inline-start:-", ";transform-origin:50% 50%;animation:", " ", "s;max-height:unset;&[data-icon-status='transfers']{transform:scale(", ",1);inset-inline-start:", ";}&[data-icon-status='away'] circle{display:none;}}"], offset, props.theme.borderStyles.solid, size, size, size, size, offset, offset, iconFadeIn, TRANSITION_DURATION, props.theme.rtl ? -1 : 1, props.$size === 'extrasmall' ? '-1px' : undefined);
220
220
  };
221
221
  const colorStyles$2 = _ref => {
222
222
  let {
@@ -243,7 +243,7 @@ const colorStyles$2 = _ref => {
243
243
  };
244
244
  const StyledStatusIndicatorBase = styled__default.default.div.attrs({
245
245
  'data-garden-id': COMPONENT_ID$5,
246
- 'data-garden-version': '9.7.2'
246
+ 'data-garden-version': '9.8.0'
247
247
  }).withConfig({
248
248
  displayName: "StyledStatusIndicatorBase",
249
249
  componentId: "sc-1rininy-0"
@@ -256,7 +256,8 @@ StyledStatusIndicatorBase.defaultProps = {
256
256
  const COMPONENT_ID$4 = 'avatars.status_indicator';
257
257
  const [xxs, xs, s, m, l] = SIZE;
258
258
  const sizeStyles$2 = props => {
259
- const isVisible = !includes([xxs, xs], props.$size);
259
+ const isVisible = props.$size !== xxs;
260
+ const iconSize = props.$size === xs ? `${props.theme.space.base * 2}px` : undefined;
260
261
  const borderWidth = getStatusBorderOffset(props);
261
262
  let padding = '0';
262
263
  if (props.$size === s) {
@@ -264,7 +265,7 @@ const sizeStyles$2 = props => {
264
265
  } else if (includes([m, l], props.$size)) {
265
266
  padding = polished.math(`${props.theme.space.base + 3}px - (${borderWidth} * 2)`);
266
267
  }
267
- return styled.css(["max-width:calc(2em + (", " * 3));box-sizing:content-box;overflow:hidden;text-align:center;text-overflow:ellipsis;white-space:nowrap;font-size:", ";font-weight:", ";& > span{display:", ";padding:0 ", ";max-width:2em;overflow:inherit;text-align:inherit;text-overflow:inherit;white-space:inherit;}& > svg{", "}"], borderWidth, props.theme.fontSizes.xs, props.theme.fontWeights.semibold, isVisible ? 'inline-block' : 'none', padding, !isVisible && 'display: none;');
268
+ return styled.css(["max-width:calc(2em + (", " * 3));box-sizing:content-box;overflow:hidden;text-align:center;text-overflow:ellipsis;white-space:nowrap;font-size:", ";font-weight:", ";& > span{display:", ";padding:0 ", ";max-width:2em;overflow:inherit;text-align:inherit;text-overflow:inherit;white-space:inherit;}& > svg{", " width:", ";height:", ";}"], borderWidth, props.theme.fontSizes.xs, props.theme.fontWeights.semibold, isVisible ? 'inline-block' : 'none', padding, !isVisible && 'display: none;', iconSize, iconSize);
268
269
  };
269
270
  const colorStyles$1 = _ref => {
270
271
  let {
@@ -292,7 +293,7 @@ const colorStyles$1 = _ref => {
292
293
  };
293
294
  const StyledStatusIndicator = styled__default.default(StyledStatusIndicatorBase).attrs({
294
295
  'data-garden-id': COMPONENT_ID$4,
295
- 'data-garden-version': '9.7.2'
296
+ 'data-garden-version': '9.8.0'
296
297
  }).withConfig({
297
298
  displayName: "StyledStatusIndicator",
298
299
  componentId: "sc-16t9if3-0"
@@ -398,7 +399,7 @@ const sizeStyles$1 = props => {
398
399
  };
399
400
  const StyledAvatar = styled__default.default.figure.attrs({
400
401
  'data-garden-id': COMPONENT_ID$3,
401
- 'data-garden-version': '9.7.2'
402
+ 'data-garden-version': '9.8.0'
402
403
  }).withConfig({
403
404
  displayName: "StyledAvatar",
404
405
  componentId: "sc-608m04-0"
@@ -411,7 +412,7 @@ StyledAvatar.defaultProps = {
411
412
  const COMPONENT_ID$2 = 'avatars.status-indicator.status';
412
413
  const StyledStandaloneStatus = styled__default.default.figure.attrs({
413
414
  'data-garden-id': COMPONENT_ID$2,
414
- 'data-garden-version': '9.7.2'
415
+ 'data-garden-version': '9.8.0'
415
416
  }).withConfig({
416
417
  displayName: "StyledStandaloneStatus",
417
418
  componentId: "sc-1ow4nfj-0"
@@ -424,7 +425,7 @@ function sizeStyles(props) {
424
425
  }
425
426
  const StyledStandaloneStatusCaption = styled__default.default.figcaption.attrs({
426
427
  'data-garden-id': COMPONENT_ID$1,
427
- 'data-garden-version': '9.7.2'
428
+ 'data-garden-version': '9.8.0'
428
429
  }).withConfig({
429
430
  displayName: "StyledStandaloneStatusCaption",
430
431
  componentId: "sc-aalyk1-0"
@@ -433,7 +434,7 @@ const StyledStandaloneStatusCaption = styled__default.default.figcaption.attrs({
433
434
  const COMPONENT_ID = 'avatars.status-indicator.indicator';
434
435
  const StyledStandaloneStatusIndicator = styled__default.default(StyledStatusIndicatorBase).attrs({
435
436
  'data-garden-id': COMPONENT_ID,
436
- 'data-garden-version': '9.7.2'
437
+ 'data-garden-version': '9.8.0'
437
438
  }).withConfig({
438
439
  displayName: "StyledStandaloneStatusIndicator",
439
440
  componentId: "sc-1xt1heq-0"
@@ -540,16 +541,17 @@ const StatusIndicator = React.forwardRef((_ref, ref) => {
540
541
  const defaultLabel = React.useMemo(() => ['status'].concat(type || []).join(': '), [type]);
541
542
  const ariaLabel = reactTheming.useText(StatusIndicator, {
542
543
  'aria-label': label
543
- }, 'aria-label', defaultLabel);
544
+ }, 'aria-label', defaultLabel, label !== null);
544
545
  return (
545
546
  React__namespace.default.createElement(StyledStandaloneStatus, Object.assign({
546
547
  role: "status",
547
548
  ref: ref
548
549
  }, props), React__namespace.default.createElement(StyledStandaloneStatusIndicator, {
550
+ "aria-hidden": label === null ? true : undefined,
551
+ "aria-label": ariaLabel,
549
552
  role: "img",
550
553
  $type: type,
551
- $size: isCompact ? 'small' : 'medium',
552
- "aria-label": ariaLabel
554
+ $size: isCompact ? 'small' : 'medium'
553
555
  }, type === 'away' ? React__namespace.default.createElement(ClockIcon, {
554
556
  "data-icon-status": type,
555
557
  "aria-hidden": "true"
@@ -561,6 +563,7 @@ const StatusIndicator = React.forwardRef((_ref, ref) => {
561
563
  });
562
564
  StatusIndicator.displayName = 'StatusIndicator';
563
565
  StatusIndicator.propTypes = {
566
+ 'aria-label': PropTypes__default.default.string,
564
567
  type: PropTypes__default.default.oneOf(STATUS),
565
568
  isCompact: PropTypes__default.default.bool
566
569
  };
@@ -39,7 +39,9 @@ export interface IAvatarProps extends HTMLAttributes<HTMLElement> {
39
39
  /** Sets the badge text and applies active styling */
40
40
  badge?: string | number;
41
41
  }
42
- export interface IStatusIndicatorProps extends HTMLAttributes<HTMLElement> {
42
+ export interface IStatusIndicatorProps extends Omit<HTMLAttributes<HTMLElement>, 'aria-label'> {
43
+ /** Overrides the label for the status indicator. Use `null` to mark the indicator as decorative. */
44
+ 'aria-label'?: string | null;
43
45
  /** Applies status type for styling and default aria-label */
44
46
  type?: (typeof STATUS)[number];
45
47
  /** Applies compact styling */
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@zendeskgarden/react-avatars",
3
- "version": "9.7.2",
3
+ "version": "9.8.0",
4
4
  "description": "Components relating to avatars in the Garden Design System",
5
5
  "license": "Apache-2.0",
6
6
  "author": "Zendesk Garden <garden@zendesk.com>",
@@ -21,7 +21,7 @@
21
21
  "sideEffects": false,
22
22
  "types": "dist/typings/index.d.ts",
23
23
  "dependencies": {
24
- "@zendeskgarden/react-typography": "^9.7.2",
24
+ "@zendeskgarden/react-typography": "^9.8.0",
25
25
  "polished": "^4.3.1",
26
26
  "prop-types": "^15.5.7"
27
27
  },
@@ -32,8 +32,8 @@
32
32
  "styled-components": "^5.3.1 || ^6.0.0"
33
33
  },
34
34
  "devDependencies": {
35
- "@zendeskgarden/react-dropdowns": "^9.7.2",
36
- "@zendeskgarden/react-theming": "^9.7.2",
35
+ "@zendeskgarden/react-dropdowns": "^9.8.0",
36
+ "@zendeskgarden/react-theming": "^9.8.0",
37
37
  "@zendeskgarden/svg-icons": "7.5.0"
38
38
  },
39
39
  "keywords": [
@@ -46,5 +46,5 @@
46
46
  "access": "public"
47
47
  },
48
48
  "zendeskgarden:src": "src/index.ts",
49
- "gitHead": "6cef5e656fa78619c4e42af330a53014c336a259"
49
+ "gitHead": "3f857a99f2e7c6c6d5db454a2fdfa1b0e129b7ab"
50
50
  }