@zendeskgarden/react-avatars 9.0.0-next.9 → 9.0.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/dist/esm/elements/Avatar.js +10 -10
- package/dist/esm/elements/StatusIndicator.js +3 -3
- package/dist/esm/node_modules/@zendeskgarden/svg-icons/src/12/arrow-left-sm-stroke.svg.js +1 -1
- package/dist/esm/node_modules/@zendeskgarden/svg-icons/src/12/clock-stroke.svg.js +1 -1
- package/dist/esm/node_modules/@zendeskgarden/svg-icons/src/16/arrow-left-sm-stroke.svg.js +1 -1
- package/dist/esm/node_modules/@zendeskgarden/svg-icons/src/16/clock-stroke.svg.js +1 -1
- package/dist/esm/styled/StyledAvatar.js +55 -25
- package/dist/esm/styled/StyledStandaloneStatus.js +2 -5
- package/dist/esm/styled/StyledStandaloneStatusCaption.js +2 -5
- package/dist/esm/styled/StyledStandaloneStatusIndicator.js +2 -2
- package/dist/esm/styled/StyledStatusIndicator.js +27 -17
- package/dist/esm/styled/StyledStatusIndicatorBase.js +25 -11
- package/dist/esm/styled/StyledText.js +2 -5
- package/dist/esm/styled/utility.js +59 -18
- package/dist/index.cjs.js +184 -98
- package/dist/typings/elements/Avatar.d.ts +3 -1
- package/dist/typings/styled/StyledAvatar.d.ts +7 -2
- package/dist/typings/styled/StyledStatusIndicator.d.ts +4 -2
- package/dist/typings/styled/utility.d.ts +3 -3
- package/dist/typings/types/index.d.ts +17 -3
- package/package.json +8 -8
- package/LICENSE.md +0 -176
|
@@ -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 (
|
|
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 (
|
|
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 (
|
|
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 (
|
|
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,
|
|
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
|
|
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
|
|
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 =
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
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
|
|
76
|
+
if (props.$size === 'extraextrasmall') {
|
|
47
77
|
boxShadow = `0 0 0 ${math(`${props.theme.shadowWidths.sm} - 1`)}`;
|
|
48
|
-
borderRadius = props
|
|
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
|
|
82
|
+
} else if (props.$size === 'extrasmall') {
|
|
53
83
|
boxShadow = `inset 0 0 0 ${props.theme.shadowWidths.sm}`;
|
|
54
|
-
borderRadius = props
|
|
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
|
|
88
|
+
} else if (props.$size === 'small') {
|
|
59
89
|
boxShadow = `inset 0 0 0 ${props.theme.shadowWidths.sm}`;
|
|
60
|
-
borderRadius = props
|
|
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
|
|
94
|
+
} else if (props.$size === 'large') {
|
|
65
95
|
boxShadow = `inset 0 0 0 ${props.theme.shadowWidths.sm}`;
|
|
66
|
-
borderRadius = props
|
|
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
|
|
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
|
|
111
|
+
'data-garden-version': '9.0.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
|
|
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
|
|
14
|
+
'data-garden-version': '9.0.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,
|
|
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
|
|
17
|
+
'data-garden-version': '9.0.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
|
|
15
|
+
'data-garden-version': '9.0.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,
|
|
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
|
|
17
|
+
const isVisible = !includes([xxs, xs], props.$size);
|
|
18
18
|
const borderWidth = getStatusBorderOffset(props);
|
|
19
19
|
let padding = '0';
|
|
20
|
-
if (props
|
|
20
|
+
if (props.$size === s) {
|
|
21
21
|
padding = math(`${props.theme.space.base + 1}px - (${borderWidth} * 2)`);
|
|
22
|
-
} else if (includes([m, l], props
|
|
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 =
|
|
28
|
-
|
|
27
|
+
const colorStyles = _ref => {
|
|
28
|
+
let {
|
|
29
29
|
theme,
|
|
30
|
-
type,
|
|
31
|
-
size,
|
|
32
|
-
borderColor,
|
|
33
|
-
surfaceColor
|
|
34
|
-
} =
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
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
|
|
53
|
+
'data-garden-version': '9.0.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:", ";
|
|
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 =
|
|
19
|
-
let
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
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,
|
|
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
|
|
43
|
+
'data-garden-version': '9.0.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
|
|
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
|
|
13
|
+
'data-garden-version': '9.0.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 {
|
|
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
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
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
|
|
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
|
|
34
|
-
switch (props
|
|
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:
|