@zendeskgarden/react-avatars 9.0.0-next.9 → 9.1.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.
@@ -51,18 +51,18 @@ const AvatarComponent = forwardRef((_ref, ref) => {
51
51
  const statusLabel = useText(AvatarComponent, props, 'statusLabel', defaultStatusLabel, shouldValidate);
52
52
  return React__default.createElement(StyledAvatar, Object.assign({
53
53
  ref: ref,
54
- isSystem: isSystem,
55
- size: size,
56
- status: computedStatus,
57
- surfaceColor: surfaceColor,
58
- backgroundColor: backgroundColor,
59
- foregroundColor: foregroundColor,
54
+ $isSystem: isSystem,
55
+ $size: size,
56
+ $status: computedStatus,
57
+ $surfaceColor: surfaceColor,
58
+ $backgroundColor: backgroundColor,
59
+ $foregroundColor: foregroundColor,
60
60
  "aria-atomic": "true",
61
61
  "aria-live": "polite"
62
- }, props), Children.only(children), computedStatus && React__default.createElement(StyledStatusIndicator, {
63
- size: size,
64
- type: computedStatus,
65
- surfaceColor: surfaceColor,
62
+ }, props), Children.only(children), !!computedStatus && React__default.createElement(StyledStatusIndicator, {
63
+ $size: size,
64
+ $type: computedStatus,
65
+ $surfaceColor: surfaceColor,
66
66
  "aria-label": statusLabel,
67
67
  as: "figcaption"
68
68
  }, computedStatus === 'active' ? React__default.createElement("span", {
@@ -43,8 +43,8 @@ const StatusIndicator = forwardRef((_ref, ref) => {
43
43
  ref: ref
44
44
  }, props), React__default.createElement(StyledStandaloneStatusIndicator, {
45
45
  role: "img",
46
- type: type,
47
- size: isCompact ? 'small' : 'medium',
46
+ $type: type,
47
+ $size: isCompact ? 'small' : 'medium',
48
48
  "aria-label": ariaLabel
49
49
  }, type === 'away' ? React__default.createElement(ClockIcon, {
50
50
  "data-icon-status": type,
@@ -52,7 +52,7 @@ const StatusIndicator = forwardRef((_ref, ref) => {
52
52
  }) : null, type === 'transfers' ? React__default.createElement(ArrowLeftIcon, {
53
53
  "data-icon-status": type,
54
54
  "aria-hidden": "true"
55
- }) : null), children && React__default.createElement(StyledStandaloneStatusCaption, null, children))
55
+ }) : null), !!children && React__default.createElement(StyledStandaloneStatusCaption, null, children))
56
56
  );
57
57
  });
58
58
  StatusIndicator.displayName = 'StatusIndicator';
@@ -7,7 +7,7 @@
7
7
  import * as React from 'react';
8
8
 
9
9
  var _path;
10
- function _extends() { _extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
10
+ function _extends() { return _extends = Object.assign ? Object.assign.bind() : function (n) { for (var e = 1; e < arguments.length; e++) { var t = arguments[e]; for (var r in t) ({}).hasOwnProperty.call(t, r) && (n[r] = t[r]); } return n; }, _extends.apply(null, arguments); }
11
11
  var SvgArrowLeftSmStroke = function SvgArrowLeftSmStroke(props) {
12
12
  return /*#__PURE__*/React.createElement("svg", _extends({
13
13
  xmlns: "http://www.w3.org/2000/svg",
@@ -7,7 +7,7 @@
7
7
  import * as React from 'react';
8
8
 
9
9
  var _g;
10
- function _extends() { _extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
10
+ function _extends() { return _extends = Object.assign ? Object.assign.bind() : function (n) { for (var e = 1; e < arguments.length; e++) { var t = arguments[e]; for (var r in t) ({}).hasOwnProperty.call(t, r) && (n[r] = t[r]); } return n; }, _extends.apply(null, arguments); }
11
11
  var SvgClockStroke = function SvgClockStroke(props) {
12
12
  return /*#__PURE__*/React.createElement("svg", _extends({
13
13
  xmlns: "http://www.w3.org/2000/svg",
@@ -7,7 +7,7 @@
7
7
  import * as React from 'react';
8
8
 
9
9
  var _path;
10
- function _extends() { _extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
10
+ function _extends() { return _extends = Object.assign ? Object.assign.bind() : function (n) { for (var e = 1; e < arguments.length; e++) { var t = arguments[e]; for (var r in t) ({}).hasOwnProperty.call(t, r) && (n[r] = t[r]); } return n; }, _extends.apply(null, arguments); }
11
11
  var SvgArrowLeftSmStroke = function SvgArrowLeftSmStroke(props) {
12
12
  return /*#__PURE__*/React.createElement("svg", _extends({
13
13
  xmlns: "http://www.w3.org/2000/svg",
@@ -7,7 +7,7 @@
7
7
  import * as React from 'react';
8
8
 
9
9
  var _g;
10
- function _extends() { _extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
10
+ function _extends() { return _extends = Object.assign ? Object.assign.bind() : function (n) { for (var e = 1; e < arguments.length; e++) { var t = arguments[e]; for (var r in t) ({}).hasOwnProperty.call(t, r) && (n[r] = t[r]); } return n; }, _extends.apply(null, arguments); }
11
11
  var SvgClockStroke = function SvgClockStroke(props) {
12
12
  return /*#__PURE__*/React.createElement("svg", _extends({
13
13
  xmlns: "http://www.w3.org/2000/svg",
@@ -5,7 +5,7 @@
5
5
  * found at http://www.apache.org/licenses/LICENSE-2.0.
6
6
  */
7
7
  import styled, { keyframes, css } from 'styled-components';
8
- import { retrieveComponentStyles, DEFAULT_THEME, getColorV8 } from '@zendeskgarden/react-theming';
8
+ import { retrieveComponentStyles, DEFAULT_THEME, getColor } from '@zendeskgarden/react-theming';
9
9
  import { math } from 'polished';
10
10
  import { SIZE } from '../types/index.js';
11
11
  import { StyledText } from './StyledText.js';
@@ -16,26 +16,56 @@ const COMPONENT_ID = 'avatars.avatar';
16
16
  const badgeStyles = props => {
17
17
  const [xxs, xs, s, m, l] = SIZE;
18
18
  let position = `${props.theme.space.base * -1}px`;
19
- switch (props.size) {
20
- case s:
21
- case m:
22
- position = math(`${position} + 2`);
23
- break;
19
+ switch (props.$size) {
24
20
  case xxs:
25
21
  case xs:
26
- case l:
27
22
  position = math(`${position} + 3`);
28
23
  break;
24
+ case s:
25
+ case m:
26
+ case l:
27
+ position = math(`${position} + 2`);
28
+ break;
29
29
  }
30
30
  const animation = keyframes(["0%{transform:scale(.1);}"]);
31
- return css(["position:absolute;", ":", ";bottom:", ";transition:all ", "s ease-in-out;", ""], props.theme.rtl ? 'left' : 'right', position, position, TRANSITION_DURATION, props.status === 'active' && css(["animation:", " ", "s ease-in-out;"], animation, TRANSITION_DURATION * 1.5));
31
+ return css(["position:absolute;", ":", ";bottom:", ";transition:all ", "s ease-in-out;", ""], props.theme.rtl ? 'left' : 'right', position, position, TRANSITION_DURATION, props.$status === 'active' && css(["animation:", " ", "s ease-in-out;"], animation, TRANSITION_DURATION * 1.5));
32
32
  };
33
- const colorStyles = props => {
34
- const statusColor = getStatusColor(props.status, props.theme);
35
- const backgroundColor = props.backgroundColor || 'transparent';
36
- const foregroundColor = props.foregroundColor || props.theme.palette.white;
37
- const surfaceColor = props.status ? props.surfaceColor || getColorV8('background', 600 , props.theme) : 'transparent';
38
- return css(["box-shadow:", ";background-color:", ";color:", ";& > svg,& ", "{color:", ";}"], props.theme.shadows.sm(statusColor), backgroundColor, surfaceColor, StyledText, foregroundColor);
33
+ const colorStyles = _ref => {
34
+ let {
35
+ theme,
36
+ $foregroundColor,
37
+ $surfaceColor,
38
+ $backgroundColor,
39
+ $status
40
+ } = _ref;
41
+ const statusColor = getStatusColor(theme, $status);
42
+ let backgroundColor = 'transparent';
43
+ let foregroundColor = theme.palette.white;
44
+ let surfaceColor;
45
+ if ($backgroundColor) {
46
+ backgroundColor = $backgroundColor.includes('.') ? getColor({
47
+ theme,
48
+ variable: $backgroundColor
49
+ }) : $backgroundColor;
50
+ }
51
+ if ($foregroundColor) {
52
+ foregroundColor = $foregroundColor.includes('.') ? getColor({
53
+ theme,
54
+ variable: $foregroundColor
55
+ }) : $foregroundColor;
56
+ }
57
+ if ($status) {
58
+ surfaceColor = $surfaceColor?.includes('.') ? getColor({
59
+ variable: $surfaceColor,
60
+ theme
61
+ }) : $surfaceColor || getColor({
62
+ variable: 'background.default',
63
+ theme
64
+ });
65
+ } else {
66
+ surfaceColor = 'transparent';
67
+ }
68
+ return css(["box-shadow:", ";background-color:", ";&&{color:", ";}& > svg,& ", "{color:", ";}"], theme.shadows.sm(statusColor), backgroundColor, surfaceColor, StyledText, foregroundColor);
39
69
  };
40
70
  const sizeStyles = props => {
41
71
  let boxShadow;
@@ -43,33 +73,33 @@ const sizeStyles = props => {
43
73
  let size;
44
74
  let fontSize;
45
75
  let svgSize;
46
- if (props.size === 'extraextrasmall') {
76
+ if (props.$size === 'extraextrasmall') {
47
77
  boxShadow = `0 0 0 ${math(`${props.theme.shadowWidths.sm} - 1`)}`;
48
- borderRadius = props.isSystem ? math(`${props.theme.borderRadii.md} - 1`) : '50%';
78
+ borderRadius = props.$isSystem ? math(`${props.theme.borderRadii.md} - 1`) : '50%';
49
79
  size = `${props.theme.space.base * 4}px`;
50
80
  fontSize = 0;
51
81
  svgSize = `${props.theme.space.base * 3}px`;
52
- } else if (props.size === 'extrasmall') {
82
+ } else if (props.$size === 'extrasmall') {
53
83
  boxShadow = `inset 0 0 0 ${props.theme.shadowWidths.sm}`;
54
- borderRadius = props.isSystem ? math(`${props.theme.borderRadii.md} - 1`) : '50%';
84
+ borderRadius = props.$isSystem ? math(`${props.theme.borderRadii.md} - 1`) : '50%';
55
85
  size = `${props.theme.space.base * 6}px`;
56
86
  fontSize = props.theme.fontSizes.sm;
57
87
  svgSize = `${props.theme.space.base * 3}px`;
58
- } else if (props.size === 'small') {
88
+ } else if (props.$size === 'small') {
59
89
  boxShadow = `inset 0 0 0 ${props.theme.shadowWidths.sm}`;
60
- borderRadius = props.isSystem ? math(`${props.theme.borderRadii.md} - 1`) : '50%';
90
+ borderRadius = props.$isSystem ? math(`${props.theme.borderRadii.md} - 1`) : '50%';
61
91
  size = `${props.theme.space.base * 8}px`;
62
92
  fontSize = props.theme.fontSizes.md;
63
93
  svgSize = `${props.theme.space.base * 3}px`;
64
- } else if (props.size === 'large') {
94
+ } else if (props.$size === 'large') {
65
95
  boxShadow = `inset 0 0 0 ${props.theme.shadowWidths.sm}`;
66
- borderRadius = props.isSystem ? math(`${props.theme.borderRadii.md} + 1`) : '50%';
96
+ borderRadius = props.$isSystem ? math(`${props.theme.borderRadii.md} + 1`) : '50%';
67
97
  size = `${props.theme.space.base * 12}px`;
68
98
  fontSize = props.theme.fontSizes.xl;
69
99
  svgSize = `${props.theme.space.base * 6}px`;
70
100
  } else {
71
101
  boxShadow = `inset 0 0 0 ${props.theme.shadowWidths.sm}`;
72
- borderRadius = props.isSystem ? props.theme.borderRadii.md : '50%';
102
+ borderRadius = props.$isSystem ? props.theme.borderRadii.md : '50%';
73
103
  size = `${props.theme.space.base * 10}px`;
74
104
  fontSize = props.theme.fontSizes.lg;
75
105
  svgSize = `${props.theme.space.base * 4}px`;
@@ -78,13 +108,13 @@ const sizeStyles = props => {
78
108
  };
79
109
  const StyledAvatar = styled.figure.attrs({
80
110
  'data-garden-id': COMPONENT_ID,
81
- 'data-garden-version': '9.0.0-next.9'
111
+ 'data-garden-version': '9.1.0'
82
112
  }).withConfig({
83
113
  displayName: "StyledAvatar",
84
114
  componentId: "sc-608m04-0"
85
115
  })(["display:inline-flex;position:relative;align-items:center;justify-content:center;transition:box-shadow ", "s ease-in-out,color 0.1s ease-in-out;margin:0;vertical-align:middle;box-sizing:border-box;", ";", ";&::before{position:absolute;top:0;left:0;transition:box-shadow ", "s ease-in-out;content:'';}&::before,&& > img{border-radius:inherit;width:100%;height:100%;}&& > img{box-sizing:inherit;vertical-align:bottom;object-fit:cover;}&& > svg{width:1em;height:1em;}& > ", "{", ";}", ";"], TRANSITION_DURATION, props => sizeStyles(props), props => colorStyles(props), TRANSITION_DURATION, StyledStatusIndicator, badgeStyles, props => retrieveComponentStyles(COMPONENT_ID, props));
86
116
  StyledAvatar.defaultProps = {
87
- size: 'medium',
117
+ $size: 'medium',
88
118
  theme: DEFAULT_THEME
89
119
  };
90
120
 
@@ -5,19 +5,16 @@
5
5
  * found at http://www.apache.org/licenses/LICENSE-2.0.
6
6
  */
7
7
  import styled from 'styled-components';
8
- import { retrieveComponentStyles, DEFAULT_THEME } from '@zendeskgarden/react-theming';
8
+ import { retrieveComponentStyles } from '@zendeskgarden/react-theming';
9
9
  import { TRANSITION_DURATION } from './utility.js';
10
10
 
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.0.0-next.9'
14
+ 'data-garden-version': '9.1.0'
15
15
  }).withConfig({
16
16
  displayName: "StyledStandaloneStatus",
17
17
  componentId: "sc-1ow4nfj-0"
18
18
  })(["display:inline-flex;flex-flow:row nowrap;transition:all ", "s ease-in-out;margin:0;box-sizing:content-box;", ";"], TRANSITION_DURATION, props => retrieveComponentStyles(COMPONENT_ID, props));
19
- StyledStandaloneStatus.defaultProps = {
20
- theme: DEFAULT_THEME
21
- };
22
19
 
23
20
  export { StyledStandaloneStatus };
@@ -5,7 +5,7 @@
5
5
  * found at http://www.apache.org/licenses/LICENSE-2.0.
6
6
  */
7
7
  import styled, { css } from 'styled-components';
8
- import { retrieveComponentStyles, DEFAULT_THEME, getLineHeight } from '@zendeskgarden/react-theming';
8
+ import { retrieveComponentStyles, getLineHeight } from '@zendeskgarden/react-theming';
9
9
 
10
10
  const COMPONENT_ID = 'avatars.status-indicator.caption';
11
11
  function sizeStyles(props) {
@@ -14,13 +14,10 @@ function sizeStyles(props) {
14
14
  }
15
15
  const StyledStandaloneStatusCaption = styled.figcaption.attrs({
16
16
  'data-garden-id': COMPONENT_ID,
17
- 'data-garden-version': '9.0.0-next.9'
17
+ 'data-garden-version': '9.1.0'
18
18
  }).withConfig({
19
19
  displayName: "StyledStandaloneStatusCaption",
20
20
  componentId: "sc-aalyk1-0"
21
21
  })(["", " ", ";"], sizeStyles, props => retrieveComponentStyles(COMPONENT_ID, props));
22
- StyledStandaloneStatusCaption.defaultProps = {
23
- theme: DEFAULT_THEME
24
- };
25
22
 
26
23
  export { StyledStandaloneStatusCaption };
@@ -12,13 +12,13 @@ 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.0.0-next.9'
15
+ 'data-garden-version': '9.1.0'
16
16
  }).withConfig({
17
17
  displayName: "StyledStandaloneStatusIndicator",
18
18
  componentId: "sc-1xt1heq-0"
19
19
  })(["position:relative;box-sizing:content-box;margin-top:", ";", ";"], props => `calc((${props.theme.lineHeights.md} - ${getStatusSize(props, '0')}) / 2)`, props => retrieveComponentStyles(COMPONENT_ID, props));
20
20
  StyledStandaloneStatusIndicator.defaultProps = {
21
- type: 'offline',
21
+ $type: 'offline',
22
22
  theme: DEFAULT_THEME
23
23
  };
24
24
 
@@ -5,7 +5,7 @@
5
5
  * found at http://www.apache.org/licenses/LICENSE-2.0.
6
6
  */
7
7
  import styled, { css } from 'styled-components';
8
- import { retrieveComponentStyles, DEFAULT_THEME, getColorV8 } from '@zendeskgarden/react-theming';
8
+ import { retrieveComponentStyles, DEFAULT_THEME, getColor } from '@zendeskgarden/react-theming';
9
9
  import { math } from 'polished';
10
10
  import { SIZE } from '../types/index.js';
11
11
  import { StyledStatusIndicatorBase } from './StyledStatusIndicatorBase.js';
@@ -14,39 +14,49 @@ import { includes, getStatusBorderOffset } from './utility.js';
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 = !includes([xxs, xs], props.$size);
18
18
  const borderWidth = getStatusBorderOffset(props);
19
19
  let padding = '0';
20
- if (props.size === s) {
20
+ if (props.$size === s) {
21
21
  padding = math(`${props.theme.space.base + 1}px - (${borderWidth} * 2)`);
22
- } else if (includes([m, l], props.size)) {
22
+ } else if (includes([m, l], props.$size)) {
23
23
  padding = math(`${props.theme.space.base + 3}px - (${borderWidth} * 2)`);
24
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
26
  };
27
- const colorStyles = props => {
28
- const {
27
+ const colorStyles = _ref => {
28
+ let {
29
29
  theme,
30
- type,
31
- size,
32
- borderColor,
33
- surfaceColor
34
- } = props;
35
- let boxShadow = theme.shadows.sm(surfaceColor || (type ? getColorV8('background', 600 , theme) : theme.palette.white));
36
- if (size === xxs) {
37
- boxShadow = boxShadow.replace(theme.shadowWidths.sm, '1px');
30
+ $type,
31
+ $size,
32
+ $borderColor,
33
+ $surfaceColor
34
+ } = _ref;
35
+ const shadowSize = $size === xxs ? 'xs' : 'sm';
36
+ let boxShadow;
37
+ const surfaceColor = $surfaceColor?.includes('.') ? getColor({
38
+ variable: $surfaceColor,
39
+ theme
40
+ }) : $surfaceColor;
41
+ if ($type) {
42
+ boxShadow = theme.shadows[shadowSize](surfaceColor || getColor({
43
+ theme,
44
+ variable: 'background.default'
45
+ }));
46
+ } else {
47
+ boxShadow = theme.shadows[shadowSize](surfaceColor || theme.palette.white);
38
48
  }
39
- return css(["border-color:", ";box-shadow:", ";"], borderColor, boxShadow);
49
+ return css(["border-color:", ";box-shadow:", ";"], $borderColor, boxShadow);
40
50
  };
41
51
  const StyledStatusIndicator = styled(StyledStatusIndicatorBase).attrs({
42
52
  'data-garden-id': COMPONENT_ID,
43
- 'data-garden-version': '9.0.0-next.9'
53
+ 'data-garden-version': '9.1.0'
44
54
  }).withConfig({
45
55
  displayName: "StyledStatusIndicator",
46
56
  componentId: "sc-16t9if3-0"
47
57
  })(["", " ", " ", ";"], sizeStyles, colorStyles, props => retrieveComponentStyles(COMPONENT_ID, props));
48
58
  StyledStatusIndicator.defaultProps = {
49
- size: 'medium',
59
+ $size: 'medium',
50
60
  theme: DEFAULT_THEME
51
61
  };
52
62
 
@@ -5,7 +5,7 @@
5
5
  * found at http://www.apache.org/licenses/LICENSE-2.0.
6
6
  */
7
7
  import styled, { keyframes, css } from 'styled-components';
8
- import { retrieveComponentStyles, DEFAULT_THEME } from '@zendeskgarden/react-theming';
8
+ import { retrieveComponentStyles, DEFAULT_THEME, getColor } from '@zendeskgarden/react-theming';
9
9
  import { getStatusBorderOffset, getStatusSize, TRANSITION_DURATION, getStatusColor } from './utility.js';
10
10
 
11
11
  const COMPONENT_ID = 'avatars.status-indicator.base';
@@ -13,27 +13,41 @@ 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:", ";width:", ";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, 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:-", ";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);
17
17
  };
18
- const colorStyles = props => {
19
- let backgroundColor = getStatusColor(props.type, props.theme);
20
- let borderColor = backgroundColor;
21
- if (props.type === 'offline') {
22
- borderColor = getStatusColor(props.type, props.theme);
23
- backgroundColor = props.theme.palette.white;
18
+ const colorStyles = _ref => {
19
+ let {
20
+ theme,
21
+ $type
22
+ } = _ref;
23
+ const foregroundColor = getColor({
24
+ variable: 'foreground.onEmphasis',
25
+ theme
26
+ });
27
+ let backgroundColor;
28
+ let borderColor;
29
+ if ($type === 'offline') {
30
+ borderColor = getStatusColor(theme, $type);
31
+ backgroundColor = getColor({
32
+ variable: 'background.default',
33
+ theme
34
+ });
35
+ } else {
36
+ backgroundColor = getStatusColor(theme, $type);
37
+ borderColor = backgroundColor;
24
38
  }
25
- return css(["border-color:", ";background-color:", ";color:", ";"], borderColor, backgroundColor, props.theme.palette.white);
39
+ return css(["border-color:", ";background-color:", ";color:", ";"], borderColor, backgroundColor, foregroundColor);
26
40
  };
27
41
  const StyledStatusIndicatorBase = styled.div.attrs({
28
42
  'data-garden-id': COMPONENT_ID,
29
- 'data-garden-version': '9.0.0-next.9'
43
+ 'data-garden-version': '9.1.0'
30
44
  }).withConfig({
31
45
  displayName: "StyledStatusIndicatorBase",
32
46
  componentId: "sc-1rininy-0"
33
47
  })(["transition:inherit;", " ", " ", ";"], sizeStyles, colorStyles, props => retrieveComponentStyles(COMPONENT_ID, props));
34
48
  StyledStatusIndicatorBase.defaultProps = {
35
49
  theme: DEFAULT_THEME,
36
- size: 'small'
50
+ $size: 'small'
37
51
  };
38
52
 
39
53
  export { StyledStatusIndicatorBase };
@@ -5,18 +5,15 @@
5
5
  * found at http://www.apache.org/licenses/LICENSE-2.0.
6
6
  */
7
7
  import styled from 'styled-components';
8
- import { retrieveComponentStyles, DEFAULT_THEME } from '@zendeskgarden/react-theming';
8
+ import { retrieveComponentStyles } from '@zendeskgarden/react-theming';
9
9
 
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.0.0-next.9'
13
+ 'data-garden-version': '9.1.0'
14
14
  }).withConfig({
15
15
  displayName: "StyledText",
16
16
  componentId: "sc-1a6hivh-0"
17
17
  })(["overflow:hidden;text-align:center;white-space:nowrap;", ";"], props => retrieveComponentStyles(COMPONENT_ID, props));
18
- StyledText.defaultProps = {
19
- theme: DEFAULT_THEME
20
- };
21
18
 
22
19
  export { StyledText };
@@ -4,34 +4,75 @@
4
4
  * Use of this source code is governed under the Apache License, Version 2.0
5
5
  * found at http://www.apache.org/licenses/LICENSE-2.0.
6
6
  */
7
- import { getColorV8 } from '@zendeskgarden/react-theming';
7
+ import { getColor } from '@zendeskgarden/react-theming';
8
8
  import { math } from 'polished';
9
9
  import { SIZE } from '../types/index.js';
10
10
 
11
11
  const [xxs, xs, s, m, l] = SIZE;
12
12
  const TRANSITION_DURATION = 0.25;
13
- function getStatusColor(type, theme) {
14
- switch (type) {
15
- case 'active':
16
- return getColorV8('crimson', 400, theme);
17
- case 'available':
18
- return getColorV8('mint', 400, theme);
19
- case 'away':
20
- return getColorV8('orange', 400, theme);
21
- case 'transfers':
22
- return getColorV8('azure', 400, theme);
23
- case 'offline':
24
- return getColorV8('grey', 500, theme);
25
- default:
26
- return 'transparent';
13
+ const StatusColorParams = {
14
+ active: {
15
+ hue: 'crimson',
16
+ light: {
17
+ shade: 700
18
+ },
19
+ dark: {
20
+ shade: 600
21
+ }
22
+ },
23
+ available: {
24
+ hue: 'mint',
25
+ light: {
26
+ shade: 500
27
+ },
28
+ dark: {
29
+ shade: 400
30
+ }
31
+ },
32
+ away: {
33
+ hue: 'orange',
34
+ light: {
35
+ shade: 500
36
+ },
37
+ dark: {
38
+ shade: 400
39
+ }
40
+ },
41
+ transfers: {
42
+ hue: 'azure',
43
+ light: {
44
+ shade: 500
45
+ },
46
+ dark: {
47
+ shade: 400
48
+ }
49
+ },
50
+ offline: {
51
+ hue: 'grey',
52
+ light: {
53
+ shade: 500
54
+ },
55
+ dark: {
56
+ shade: 400
57
+ }
58
+ }
59
+ };
60
+ function getStatusColor(theme, type) {
61
+ if (type === undefined) {
62
+ return 'transparent';
27
63
  }
64
+ const colorArgs = StatusColorParams[type];
65
+ return colorArgs ? getColor({
66
+ ...colorArgs,
67
+ theme
68
+ }) : 'transparent';
28
69
  }
29
70
  function getStatusBorderOffset(props) {
30
- return props.size === xxs ? math(`${props.theme.shadowWidths.sm} - 1`) : props.theme.shadowWidths.sm;
71
+ return props.$size === xxs ? math(`${props.theme.shadowWidths.sm} - 1`) : props.theme.shadowWidths.sm;
31
72
  }
32
73
  function getStatusSize(props, offset) {
33
- const isActive = props.type === 'active';
34
- switch (props.size) {
74
+ const isActive = props.$type === 'active';
75
+ switch (props.$size) {
35
76
  case xxs:
36
77
  return math(`${props.theme.space.base}px - ${offset}`);
37
78
  case xs:
package/dist/index.cjs.js CHANGED
@@ -37,7 +37,7 @@ var PropTypes__default = /*#__PURE__*/_interopDefault(PropTypes);
37
37
  var styled__default = /*#__PURE__*/_interopDefault(styled);
38
38
 
39
39
  var _g$1;
40
- function _extends$3() { _extends$3 = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends$3.apply(this, arguments); }
40
+ function _extends$3() { return _extends$3 = Object.assign ? Object.assign.bind() : function (n) { for (var e = 1; e < arguments.length; e++) { var t = arguments[e]; for (var r in t) ({}).hasOwnProperty.call(t, r) && (n[r] = t[r]); } return n; }, _extends$3.apply(null, arguments); }
41
41
  var SvgClockStroke$1 = function SvgClockStroke(props) {
42
42
  return /*#__PURE__*/React__namespace.createElement("svg", _extends$3({
43
43
  xmlns: "http://www.w3.org/2000/svg",
@@ -61,7 +61,7 @@ var SvgClockStroke$1 = function SvgClockStroke(props) {
61
61
  };
62
62
 
63
63
  var _g;
64
- function _extends$2() { _extends$2 = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends$2.apply(this, arguments); }
64
+ function _extends$2() { return _extends$2 = Object.assign ? Object.assign.bind() : function (n) { for (var e = 1; e < arguments.length; e++) { var t = arguments[e]; for (var r in t) ({}).hasOwnProperty.call(t, r) && (n[r] = t[r]); } return n; }, _extends$2.apply(null, arguments); }
65
65
  var SvgClockStroke = function SvgClockStroke(props) {
66
66
  return /*#__PURE__*/React__namespace.createElement("svg", _extends$2({
67
67
  xmlns: "http://www.w3.org/2000/svg",
@@ -85,7 +85,7 @@ var SvgClockStroke = function SvgClockStroke(props) {
85
85
  };
86
86
 
87
87
  var _path$1;
88
- function _extends$1() { _extends$1 = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends$1.apply(this, arguments); }
88
+ function _extends$1() { return _extends$1 = Object.assign ? Object.assign.bind() : function (n) { for (var e = 1; e < arguments.length; e++) { var t = arguments[e]; for (var r in t) ({}).hasOwnProperty.call(t, r) && (n[r] = t[r]); } return n; }, _extends$1.apply(null, arguments); }
89
89
  var SvgArrowLeftSmStroke$1 = function SvgArrowLeftSmStroke(props) {
90
90
  return /*#__PURE__*/React__namespace.createElement("svg", _extends$1({
91
91
  xmlns: "http://www.w3.org/2000/svg",
@@ -101,7 +101,7 @@ var SvgArrowLeftSmStroke$1 = function SvgArrowLeftSmStroke(props) {
101
101
  };
102
102
 
103
103
  var _path;
104
- function _extends() { _extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
104
+ function _extends() { return _extends = Object.assign ? Object.assign.bind() : function (n) { for (var e = 1; e < arguments.length; e++) { var t = arguments[e]; for (var r in t) ({}).hasOwnProperty.call(t, r) && (n[r] = t[r]); } return n; }, _extends.apply(null, arguments); }
105
105
  var SvgArrowLeftSmStroke = function SvgArrowLeftSmStroke(props) {
106
106
  return /*#__PURE__*/React__namespace.createElement("svg", _extends({
107
107
  xmlns: "http://www.w3.org/2000/svg",
@@ -122,39 +122,77 @@ const STATUS = ['available', 'away', 'transfers', 'offline'];
122
122
  const COMPONENT_ID$6 = 'avatars.text';
123
123
  const StyledText = styled__default.default.span.attrs({
124
124
  'data-garden-id': COMPONENT_ID$6,
125
- 'data-garden-version': '9.0.0-next.9'
125
+ 'data-garden-version': '9.1.0'
126
126
  }).withConfig({
127
127
  displayName: "StyledText",
128
128
  componentId: "sc-1a6hivh-0"
129
129
  })(["overflow:hidden;text-align:center;white-space:nowrap;", ";"], props => reactTheming.retrieveComponentStyles(COMPONENT_ID$6, props));
130
- StyledText.defaultProps = {
131
- theme: reactTheming.DEFAULT_THEME
132
- };
133
130
 
134
131
  const [xxs$1, xs$1, s$1, m$1, l$1] = SIZE;
135
132
  const TRANSITION_DURATION = 0.25;
136
- function getStatusColor(type, theme) {
137
- switch (type) {
138
- case 'active':
139
- return reactTheming.getColorV8('crimson', 400, theme);
140
- case 'available':
141
- return reactTheming.getColorV8('mint', 400, theme);
142
- case 'away':
143
- return reactTheming.getColorV8('orange', 400, theme);
144
- case 'transfers':
145
- return reactTheming.getColorV8('azure', 400, theme);
146
- case 'offline':
147
- return reactTheming.getColorV8('grey', 500, theme);
148
- default:
149
- return 'transparent';
133
+ const StatusColorParams = {
134
+ active: {
135
+ hue: 'crimson',
136
+ light: {
137
+ shade: 700
138
+ },
139
+ dark: {
140
+ shade: 600
141
+ }
142
+ },
143
+ available: {
144
+ hue: 'mint',
145
+ light: {
146
+ shade: 500
147
+ },
148
+ dark: {
149
+ shade: 400
150
+ }
151
+ },
152
+ away: {
153
+ hue: 'orange',
154
+ light: {
155
+ shade: 500
156
+ },
157
+ dark: {
158
+ shade: 400
159
+ }
160
+ },
161
+ transfers: {
162
+ hue: 'azure',
163
+ light: {
164
+ shade: 500
165
+ },
166
+ dark: {
167
+ shade: 400
168
+ }
169
+ },
170
+ offline: {
171
+ hue: 'grey',
172
+ light: {
173
+ shade: 500
174
+ },
175
+ dark: {
176
+ shade: 400
177
+ }
150
178
  }
179
+ };
180
+ function getStatusColor(theme, type) {
181
+ if (type === undefined) {
182
+ return 'transparent';
183
+ }
184
+ const colorArgs = StatusColorParams[type];
185
+ return colorArgs ? reactTheming.getColor({
186
+ ...colorArgs,
187
+ theme
188
+ }) : 'transparent';
151
189
  }
152
190
  function getStatusBorderOffset(props) {
153
- return props.size === xxs$1 ? polished.math(`${props.theme.shadowWidths.sm} - 1`) : props.theme.shadowWidths.sm;
191
+ return props.$size === xxs$1 ? polished.math(`${props.theme.shadowWidths.sm} - 1`) : props.theme.shadowWidths.sm;
154
192
  }
155
193
  function getStatusSize(props, offset) {
156
- const isActive = props.type === 'active';
157
- switch (props.size) {
194
+ const isActive = props.$type === 'active';
195
+ switch (props.$size) {
158
196
  case xxs$1:
159
197
  return polished.math(`${props.theme.space.base}px - ${offset}`);
160
198
  case xs$1:
@@ -177,65 +215,89 @@ const iconFadeIn = styled.keyframes(["0%{opacity:0;}100%{opacity:1;}"]);
177
215
  const sizeStyles$3 = props => {
178
216
  const offset = getStatusBorderOffset(props);
179
217
  const size = getStatusSize(props, offset);
180
- return styled.css(["border:", " ", ";border-radius:", ";width:", ";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, size, offset, offset, iconFadeIn, TRANSITION_DURATION, props.theme.rtl ? -1 : 1);
218
+ 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);
181
219
  };
182
- const colorStyles$2 = props => {
183
- let backgroundColor = getStatusColor(props.type, props.theme);
184
- let borderColor = backgroundColor;
185
- if (props.type === 'offline') {
186
- borderColor = getStatusColor(props.type, props.theme);
187
- backgroundColor = props.theme.palette.white;
220
+ const colorStyles$2 = _ref => {
221
+ let {
222
+ theme,
223
+ $type
224
+ } = _ref;
225
+ const foregroundColor = reactTheming.getColor({
226
+ variable: 'foreground.onEmphasis',
227
+ theme
228
+ });
229
+ let backgroundColor;
230
+ let borderColor;
231
+ if ($type === 'offline') {
232
+ borderColor = getStatusColor(theme, $type);
233
+ backgroundColor = reactTheming.getColor({
234
+ variable: 'background.default',
235
+ theme
236
+ });
237
+ } else {
238
+ backgroundColor = getStatusColor(theme, $type);
239
+ borderColor = backgroundColor;
188
240
  }
189
- return styled.css(["border-color:", ";background-color:", ";color:", ";"], borderColor, backgroundColor, props.theme.palette.white);
241
+ return styled.css(["border-color:", ";background-color:", ";color:", ";"], borderColor, backgroundColor, foregroundColor);
190
242
  };
191
243
  const StyledStatusIndicatorBase = styled__default.default.div.attrs({
192
244
  'data-garden-id': COMPONENT_ID$5,
193
- 'data-garden-version': '9.0.0-next.9'
245
+ 'data-garden-version': '9.1.0'
194
246
  }).withConfig({
195
247
  displayName: "StyledStatusIndicatorBase",
196
248
  componentId: "sc-1rininy-0"
197
249
  })(["transition:inherit;", " ", " ", ";"], sizeStyles$3, colorStyles$2, props => reactTheming.retrieveComponentStyles(COMPONENT_ID$5, props));
198
250
  StyledStatusIndicatorBase.defaultProps = {
199
251
  theme: reactTheming.DEFAULT_THEME,
200
- size: 'small'
252
+ $size: 'small'
201
253
  };
202
254
 
203
255
  const COMPONENT_ID$4 = 'avatars.status_indicator';
204
256
  const [xxs, xs, s, m, l] = SIZE;
205
257
  const sizeStyles$2 = props => {
206
- const isVisible = !includes([xxs, xs], props.size);
258
+ const isVisible = !includes([xxs, xs], props.$size);
207
259
  const borderWidth = getStatusBorderOffset(props);
208
260
  let padding = '0';
209
- if (props.size === s) {
261
+ if (props.$size === s) {
210
262
  padding = polished.math(`${props.theme.space.base + 1}px - (${borderWidth} * 2)`);
211
- } else if (includes([m, l], props.size)) {
263
+ } else if (includes([m, l], props.$size)) {
212
264
  padding = polished.math(`${props.theme.space.base + 3}px - (${borderWidth} * 2)`);
213
265
  }
214
266
  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;');
215
267
  };
216
- const colorStyles$1 = props => {
217
- const {
268
+ const colorStyles$1 = _ref => {
269
+ let {
218
270
  theme,
219
- type,
220
- size,
221
- borderColor,
222
- surfaceColor
223
- } = props;
224
- let boxShadow = theme.shadows.sm(surfaceColor || (type ? reactTheming.getColorV8('background', 600 , theme) : theme.palette.white));
225
- if (size === xxs) {
226
- boxShadow = boxShadow.replace(theme.shadowWidths.sm, '1px');
271
+ $type,
272
+ $size,
273
+ $borderColor,
274
+ $surfaceColor
275
+ } = _ref;
276
+ const shadowSize = $size === xxs ? 'xs' : 'sm';
277
+ let boxShadow;
278
+ const surfaceColor = $surfaceColor?.includes('.') ? reactTheming.getColor({
279
+ variable: $surfaceColor,
280
+ theme
281
+ }) : $surfaceColor;
282
+ if ($type) {
283
+ boxShadow = theme.shadows[shadowSize](surfaceColor || reactTheming.getColor({
284
+ theme,
285
+ variable: 'background.default'
286
+ }));
287
+ } else {
288
+ boxShadow = theme.shadows[shadowSize](surfaceColor || theme.palette.white);
227
289
  }
228
- return styled.css(["border-color:", ";box-shadow:", ";"], borderColor, boxShadow);
290
+ return styled.css(["border-color:", ";box-shadow:", ";"], $borderColor, boxShadow);
229
291
  };
230
292
  const StyledStatusIndicator = styled__default.default(StyledStatusIndicatorBase).attrs({
231
293
  'data-garden-id': COMPONENT_ID$4,
232
- 'data-garden-version': '9.0.0-next.9'
294
+ 'data-garden-version': '9.1.0'
233
295
  }).withConfig({
234
296
  displayName: "StyledStatusIndicator",
235
297
  componentId: "sc-16t9if3-0"
236
298
  })(["", " ", " ", ";"], sizeStyles$2, colorStyles$1, props => reactTheming.retrieveComponentStyles(COMPONENT_ID$4, props));
237
299
  StyledStatusIndicator.defaultProps = {
238
- size: 'medium',
300
+ $size: 'medium',
239
301
  theme: reactTheming.DEFAULT_THEME
240
302
  };
241
303
 
@@ -243,26 +305,56 @@ const COMPONENT_ID$3 = 'avatars.avatar';
243
305
  const badgeStyles = props => {
244
306
  const [xxs, xs, s, m, l] = SIZE;
245
307
  let position = `${props.theme.space.base * -1}px`;
246
- switch (props.size) {
247
- case s:
248
- case m:
249
- position = polished.math(`${position} + 2`);
250
- break;
308
+ switch (props.$size) {
251
309
  case xxs:
252
310
  case xs:
253
- case l:
254
311
  position = polished.math(`${position} + 3`);
255
312
  break;
313
+ case s:
314
+ case m:
315
+ case l:
316
+ position = polished.math(`${position} + 2`);
317
+ break;
256
318
  }
257
319
  const animation = styled.keyframes(["0%{transform:scale(.1);}"]);
258
- return styled.css(["position:absolute;", ":", ";bottom:", ";transition:all ", "s ease-in-out;", ""], props.theme.rtl ? 'left' : 'right', position, position, TRANSITION_DURATION, props.status === 'active' && styled.css(["animation:", " ", "s ease-in-out;"], animation, TRANSITION_DURATION * 1.5));
320
+ return styled.css(["position:absolute;", ":", ";bottom:", ";transition:all ", "s ease-in-out;", ""], props.theme.rtl ? 'left' : 'right', position, position, TRANSITION_DURATION, props.$status === 'active' && styled.css(["animation:", " ", "s ease-in-out;"], animation, TRANSITION_DURATION * 1.5));
259
321
  };
260
- const colorStyles = props => {
261
- const statusColor = getStatusColor(props.status, props.theme);
262
- const backgroundColor = props.backgroundColor || 'transparent';
263
- const foregroundColor = props.foregroundColor || props.theme.palette.white;
264
- const surfaceColor = props.status ? props.surfaceColor || reactTheming.getColorV8('background', 600 , props.theme) : 'transparent';
265
- return styled.css(["box-shadow:", ";background-color:", ";color:", ";& > svg,& ", "{color:", ";}"], props.theme.shadows.sm(statusColor), backgroundColor, surfaceColor, StyledText, foregroundColor);
322
+ const colorStyles = _ref => {
323
+ let {
324
+ theme,
325
+ $foregroundColor,
326
+ $surfaceColor,
327
+ $backgroundColor,
328
+ $status
329
+ } = _ref;
330
+ const statusColor = getStatusColor(theme, $status);
331
+ let backgroundColor = 'transparent';
332
+ let foregroundColor = theme.palette.white;
333
+ let surfaceColor;
334
+ if ($backgroundColor) {
335
+ backgroundColor = $backgroundColor.includes('.') ? reactTheming.getColor({
336
+ theme,
337
+ variable: $backgroundColor
338
+ }) : $backgroundColor;
339
+ }
340
+ if ($foregroundColor) {
341
+ foregroundColor = $foregroundColor.includes('.') ? reactTheming.getColor({
342
+ theme,
343
+ variable: $foregroundColor
344
+ }) : $foregroundColor;
345
+ }
346
+ if ($status) {
347
+ surfaceColor = $surfaceColor?.includes('.') ? reactTheming.getColor({
348
+ variable: $surfaceColor,
349
+ theme
350
+ }) : $surfaceColor || reactTheming.getColor({
351
+ variable: 'background.default',
352
+ theme
353
+ });
354
+ } else {
355
+ surfaceColor = 'transparent';
356
+ }
357
+ return styled.css(["box-shadow:", ";background-color:", ";&&{color:", ";}& > svg,& ", "{color:", ";}"], theme.shadows.sm(statusColor), backgroundColor, surfaceColor, StyledText, foregroundColor);
266
358
  };
267
359
  const sizeStyles$1 = props => {
268
360
  let boxShadow;
@@ -270,33 +362,33 @@ const sizeStyles$1 = props => {
270
362
  let size;
271
363
  let fontSize;
272
364
  let svgSize;
273
- if (props.size === 'extraextrasmall') {
365
+ if (props.$size === 'extraextrasmall') {
274
366
  boxShadow = `0 0 0 ${polished.math(`${props.theme.shadowWidths.sm} - 1`)}`;
275
- borderRadius = props.isSystem ? polished.math(`${props.theme.borderRadii.md} - 1`) : '50%';
367
+ borderRadius = props.$isSystem ? polished.math(`${props.theme.borderRadii.md} - 1`) : '50%';
276
368
  size = `${props.theme.space.base * 4}px`;
277
369
  fontSize = 0;
278
370
  svgSize = `${props.theme.space.base * 3}px`;
279
- } else if (props.size === 'extrasmall') {
371
+ } else if (props.$size === 'extrasmall') {
280
372
  boxShadow = `inset 0 0 0 ${props.theme.shadowWidths.sm}`;
281
- borderRadius = props.isSystem ? polished.math(`${props.theme.borderRadii.md} - 1`) : '50%';
373
+ borderRadius = props.$isSystem ? polished.math(`${props.theme.borderRadii.md} - 1`) : '50%';
282
374
  size = `${props.theme.space.base * 6}px`;
283
375
  fontSize = props.theme.fontSizes.sm;
284
376
  svgSize = `${props.theme.space.base * 3}px`;
285
- } else if (props.size === 'small') {
377
+ } else if (props.$size === 'small') {
286
378
  boxShadow = `inset 0 0 0 ${props.theme.shadowWidths.sm}`;
287
- borderRadius = props.isSystem ? polished.math(`${props.theme.borderRadii.md} - 1`) : '50%';
379
+ borderRadius = props.$isSystem ? polished.math(`${props.theme.borderRadii.md} - 1`) : '50%';
288
380
  size = `${props.theme.space.base * 8}px`;
289
381
  fontSize = props.theme.fontSizes.md;
290
382
  svgSize = `${props.theme.space.base * 3}px`;
291
- } else if (props.size === 'large') {
383
+ } else if (props.$size === 'large') {
292
384
  boxShadow = `inset 0 0 0 ${props.theme.shadowWidths.sm}`;
293
- borderRadius = props.isSystem ? polished.math(`${props.theme.borderRadii.md} + 1`) : '50%';
385
+ borderRadius = props.$isSystem ? polished.math(`${props.theme.borderRadii.md} + 1`) : '50%';
294
386
  size = `${props.theme.space.base * 12}px`;
295
387
  fontSize = props.theme.fontSizes.xl;
296
388
  svgSize = `${props.theme.space.base * 6}px`;
297
389
  } else {
298
390
  boxShadow = `inset 0 0 0 ${props.theme.shadowWidths.sm}`;
299
- borderRadius = props.isSystem ? props.theme.borderRadii.md : '50%';
391
+ borderRadius = props.$isSystem ? props.theme.borderRadii.md : '50%';
300
392
  size = `${props.theme.space.base * 10}px`;
301
393
  fontSize = props.theme.fontSizes.lg;
302
394
  svgSize = `${props.theme.space.base * 4}px`;
@@ -305,27 +397,24 @@ const sizeStyles$1 = props => {
305
397
  };
306
398
  const StyledAvatar = styled__default.default.figure.attrs({
307
399
  'data-garden-id': COMPONENT_ID$3,
308
- 'data-garden-version': '9.0.0-next.9'
400
+ 'data-garden-version': '9.1.0'
309
401
  }).withConfig({
310
402
  displayName: "StyledAvatar",
311
403
  componentId: "sc-608m04-0"
312
404
  })(["display:inline-flex;position:relative;align-items:center;justify-content:center;transition:box-shadow ", "s ease-in-out,color 0.1s ease-in-out;margin:0;vertical-align:middle;box-sizing:border-box;", ";", ";&::before{position:absolute;top:0;left:0;transition:box-shadow ", "s ease-in-out;content:'';}&::before,&& > img{border-radius:inherit;width:100%;height:100%;}&& > img{box-sizing:inherit;vertical-align:bottom;object-fit:cover;}&& > svg{width:1em;height:1em;}& > ", "{", ";}", ";"], TRANSITION_DURATION, props => sizeStyles$1(props), props => colorStyles(props), TRANSITION_DURATION, StyledStatusIndicator, badgeStyles, props => reactTheming.retrieveComponentStyles(COMPONENT_ID$3, props));
313
405
  StyledAvatar.defaultProps = {
314
- size: 'medium',
406
+ $size: 'medium',
315
407
  theme: reactTheming.DEFAULT_THEME
316
408
  };
317
409
 
318
410
  const COMPONENT_ID$2 = 'avatars.status-indicator.status';
319
411
  const StyledStandaloneStatus = styled__default.default.figure.attrs({
320
412
  'data-garden-id': COMPONENT_ID$2,
321
- 'data-garden-version': '9.0.0-next.9'
413
+ 'data-garden-version': '9.1.0'
322
414
  }).withConfig({
323
415
  displayName: "StyledStandaloneStatus",
324
416
  componentId: "sc-1ow4nfj-0"
325
417
  })(["display:inline-flex;flex-flow:row nowrap;transition:all ", "s ease-in-out;margin:0;box-sizing:content-box;", ";"], TRANSITION_DURATION, props => reactTheming.retrieveComponentStyles(COMPONENT_ID$2, props));
326
- StyledStandaloneStatus.defaultProps = {
327
- theme: reactTheming.DEFAULT_THEME
328
- };
329
418
 
330
419
  const COMPONENT_ID$1 = 'avatars.status-indicator.caption';
331
420
  function sizeStyles(props) {
@@ -334,25 +423,22 @@ function sizeStyles(props) {
334
423
  }
335
424
  const StyledStandaloneStatusCaption = styled__default.default.figcaption.attrs({
336
425
  'data-garden-id': COMPONENT_ID$1,
337
- 'data-garden-version': '9.0.0-next.9'
426
+ 'data-garden-version': '9.1.0'
338
427
  }).withConfig({
339
428
  displayName: "StyledStandaloneStatusCaption",
340
429
  componentId: "sc-aalyk1-0"
341
430
  })(["", " ", ";"], sizeStyles, props => reactTheming.retrieveComponentStyles(COMPONENT_ID$1, props));
342
- StyledStandaloneStatusCaption.defaultProps = {
343
- theme: reactTheming.DEFAULT_THEME
344
- };
345
431
 
346
432
  const COMPONENT_ID = 'avatars.status-indicator.indicator';
347
433
  const StyledStandaloneStatusIndicator = styled__default.default(StyledStatusIndicatorBase).attrs({
348
434
  'data-garden-id': COMPONENT_ID,
349
- 'data-garden-version': '9.0.0-next.9'
435
+ 'data-garden-version': '9.1.0'
350
436
  }).withConfig({
351
437
  displayName: "StyledStandaloneStatusIndicator",
352
438
  componentId: "sc-1xt1heq-0"
353
439
  })(["position:relative;box-sizing:content-box;margin-top:", ";", ";"], props => `calc((${props.theme.lineHeights.md} - ${getStatusSize(props, '0')}) / 2)`, props => reactTheming.retrieveComponentStyles(COMPONENT_ID, props));
354
440
  StyledStandaloneStatusIndicator.defaultProps = {
355
- type: 'offline',
441
+ $type: 'offline',
356
442
  theme: reactTheming.DEFAULT_THEME
357
443
  };
358
444
 
@@ -393,18 +479,18 @@ const AvatarComponent = React.forwardRef((_ref, ref) => {
393
479
  const statusLabel = reactTheming.useText(AvatarComponent, props, 'statusLabel', defaultStatusLabel, shouldValidate);
394
480
  return React__namespace.default.createElement(StyledAvatar, Object.assign({
395
481
  ref: ref,
396
- isSystem: isSystem,
397
- size: size,
398
- status: computedStatus,
399
- surfaceColor: surfaceColor,
400
- backgroundColor: backgroundColor,
401
- foregroundColor: foregroundColor,
482
+ $isSystem: isSystem,
483
+ $size: size,
484
+ $status: computedStatus,
485
+ $surfaceColor: surfaceColor,
486
+ $backgroundColor: backgroundColor,
487
+ $foregroundColor: foregroundColor,
402
488
  "aria-atomic": "true",
403
489
  "aria-live": "polite"
404
- }, props), React.Children.only(children), computedStatus && React__namespace.default.createElement(StyledStatusIndicator, {
405
- size: size,
406
- type: computedStatus,
407
- surfaceColor: surfaceColor,
490
+ }, props), React.Children.only(children), !!computedStatus && React__namespace.default.createElement(StyledStatusIndicator, {
491
+ $size: size,
492
+ $type: computedStatus,
493
+ $surfaceColor: surfaceColor,
408
494
  "aria-label": statusLabel,
409
495
  as: "figcaption"
410
496
  }, computedStatus === 'active' ? React__namespace.default.createElement("span", {
@@ -456,8 +542,8 @@ const StatusIndicator = React.forwardRef((_ref, ref) => {
456
542
  ref: ref
457
543
  }, props), React__namespace.default.createElement(StyledStandaloneStatusIndicator, {
458
544
  role: "img",
459
- type: type,
460
- size: isCompact ? 'small' : 'medium',
545
+ $type: type,
546
+ $size: isCompact ? 'small' : 'medium',
461
547
  "aria-label": ariaLabel
462
548
  }, type === 'away' ? React__namespace.default.createElement(ClockIcon, {
463
549
  "data-icon-status": type,
@@ -465,7 +551,7 @@ const StatusIndicator = React.forwardRef((_ref, ref) => {
465
551
  }) : null, type === 'transfers' ? React__namespace.default.createElement(ArrowLeftIcon, {
466
552
  "data-icon-status": type,
467
553
  "aria-hidden": "true"
468
- }) : null), children && React__namespace.default.createElement(StyledStandaloneStatusCaption, null, children))
554
+ }) : null), !!children && React__namespace.default.createElement(StyledStandaloneStatusCaption, null, children))
469
555
  );
470
556
  });
471
557
  StatusIndicator.displayName = 'StatusIndicator';
@@ -7,9 +7,11 @@
7
7
  import React from 'react';
8
8
  import { IAvatarProps } from '../types';
9
9
  import { Text } from './components/Text';
10
+ declare const AvatarComponent: React.ForwardRefExoticComponent<IAvatarProps & React.RefAttributes<HTMLElement>>;
10
11
  /**
11
12
  * @extends HTMLAttributes<HTMLElement>
12
13
  */
13
- export declare const Avatar: React.ForwardRefExoticComponent<IAvatarProps & React.RefAttributes<HTMLElement>> & {
14
+ export declare const Avatar: typeof AvatarComponent & {
14
15
  Text: typeof Text;
15
16
  };
17
+ export {};
@@ -6,8 +6,13 @@
6
6
  */
7
7
  import { DefaultTheme } from 'styled-components';
8
8
  import { IAvatarProps } from '../types';
9
- export interface IStyledAvatarProps extends Pick<IAvatarProps, 'backgroundColor' | 'foregroundColor' | 'surfaceColor' | 'isSystem' | 'size'> {
10
- status?: IAvatarProps['status'] | 'active';
9
+ export interface IStyledAvatarProps {
10
+ $status?: IAvatarProps['status'] | 'active';
11
+ $backgroundColor?: IAvatarProps['backgroundColor'];
12
+ $foregroundColor?: IAvatarProps['foregroundColor'];
13
+ $surfaceColor?: IAvatarProps['surfaceColor'];
14
+ $isSystem?: IAvatarProps['isSystem'];
15
+ $size?: IAvatarProps['size'];
11
16
  }
12
17
  /**
13
18
  * Accepts all `<figure>` props
@@ -8,8 +8,10 @@ import { DefaultTheme } from 'styled-components';
8
8
  import { IAvatarProps } from '../types';
9
9
  import { IStyledStatusIndicatorProps } from './utility';
10
10
  export interface IStatusIndicatorProps extends Omit<IAvatarProps, 'badge' | 'isSystem' | 'status'> {
11
- readonly type?: IStyledStatusIndicatorProps['type'];
12
- borderColor?: string;
11
+ readonly $type?: IStyledStatusIndicatorProps['$type'];
12
+ $borderColor?: string;
13
+ $surfaceColor?: IAvatarProps['surfaceColor'];
14
+ $size?: IAvatarProps['size'];
13
15
  }
14
16
  export declare const StyledStatusIndicator: import("styled-components").StyledComponent<"div", DefaultTheme, {
15
17
  'data-garden-id': string;
@@ -8,10 +8,10 @@ import { ThemeProps, DefaultTheme } from 'styled-components';
8
8
  import { IAvatarProps } from '../types';
9
9
  export declare const TRANSITION_DURATION = 0.25;
10
10
  export interface IStyledStatusIndicatorProps extends ThemeProps<DefaultTheme> {
11
- readonly size?: IAvatarProps['size'];
12
- readonly type?: IAvatarProps['status'] | 'active';
11
+ readonly $size?: IAvatarProps['size'];
12
+ readonly $type?: IAvatarProps['status'] | 'active';
13
13
  }
14
- export declare function getStatusColor(type?: IStyledStatusIndicatorProps['type'], theme?: IStyledStatusIndicatorProps['theme']): string;
14
+ export declare function getStatusColor(theme: IStyledStatusIndicatorProps['theme'], type?: IStyledStatusIndicatorProps['$type']): string;
15
15
  export declare function getStatusBorderOffset(props: IStyledStatusIndicatorProps): string;
16
16
  export declare function getStatusSize(props: IStyledStatusIndicatorProps, offset: string): string;
17
17
  export declare function includes<T extends U, U>(array: readonly T[], element: U): element is T;
@@ -8,11 +8,25 @@ import { HTMLAttributes } from 'react';
8
8
  export declare const SIZE: readonly ["extraextrasmall", "extrasmall", "small", "medium", "large"];
9
9
  export declare const STATUS: readonly ["available", "away", "transfers", "offline"];
10
10
  export interface IAvatarProps extends HTMLAttributes<HTMLElement> {
11
- /** Sets the avatar background color */
11
+ /**
12
+ * Sets the avatar background color. Accepts a [color
13
+ * variable](/components/theme-object#colors) key (i.e.
14
+ * `background.emphasis`) to render based on light/dark mode, or any hex
15
+ * value.
16
+ */
12
17
  backgroundColor?: string;
13
- /** Sets the color for child SVG or `Avatar.Text` components */
18
+ /**
19
+ * Sets the color for child SVG or `Avatar.Text` components. Accepts a [color
20
+ * variable](/components/theme-object#colors) key (i.e.
21
+ * `foreground.onEmphasis`) to render based on light/dark mode, or any hex
22
+ * value.
23
+ */
14
24
  foregroundColor?: string;
15
- /** Provides surface color for an avatar placed on a non-white background */
25
+ /**
26
+ * Provides surface color for an avatar placed on a non-default background.
27
+ * Accepts a [color variable](/components/theme-object#colors) key (i.e.
28
+ * `background.subtle`) to render based on light/dark mode, or any hex value.
29
+ */
16
30
  surfaceColor?: string;
17
31
  /** Applies system styling for representing objects, brands, or products */
18
32
  isSystem?: boolean;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@zendeskgarden/react-avatars",
3
- "version": "9.0.0-next.9",
3
+ "version": "9.1.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,18 +21,19 @@
21
21
  "sideEffects": false,
22
22
  "types": "dist/typings/index.d.ts",
23
23
  "dependencies": {
24
- "polished": "^4.0.0",
24
+ "polished": "^4.3.1",
25
25
  "prop-types": "^15.5.7"
26
26
  },
27
27
  "peerDependencies": {
28
28
  "@zendeskgarden/react-theming": ">=9.0.0-next",
29
- "react": ">=16.8.0",
30
- "react-dom": ">=16.8.0",
29
+ "react": "^16.8.0 || ^17.0.0 || ^18.0.0",
30
+ "react-dom": "^16.8.0 || ^17.0.0 || ^18.0.0",
31
31
  "styled-components": "^5.3.1"
32
32
  },
33
33
  "devDependencies": {
34
- "@zendeskgarden/react-theming": "^9.0.0-next.9",
35
- "@zendeskgarden/svg-icons": "7.0.0"
34
+ "@zendeskgarden/react-dropdowns": "^9.1.0",
35
+ "@zendeskgarden/react-theming": "^9.1.0",
36
+ "@zendeskgarden/svg-icons": "7.3.0"
36
37
  },
37
38
  "keywords": [
38
39
  "components",
@@ -44,5 +45,5 @@
44
45
  "access": "public"
45
46
  },
46
47
  "zendeskgarden:src": "src/index.ts",
47
- "gitHead": "771281b562d376a6aee04b0cd71dd888b3ae4a1d"
48
+ "gitHead": "a2842d18615ad057d75988fde4df5a0c79d2714e"
48
49
  }