@zendeskgarden/react-avatars 8.62.1 → 8.63.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/index.cjs.js
CHANGED
|
@@ -7,15 +7,13 @@
|
|
|
7
7
|
|
|
8
8
|
'use strict';
|
|
9
9
|
|
|
10
|
-
Object.defineProperty(exports, '__esModule', { value: true });
|
|
11
|
-
|
|
12
10
|
var React = require('react');
|
|
13
11
|
var PropTypes = require('prop-types');
|
|
14
12
|
var reactTheming = require('@zendeskgarden/react-theming');
|
|
15
13
|
var styled = require('styled-components');
|
|
16
14
|
var polished = require('polished');
|
|
17
15
|
|
|
18
|
-
function
|
|
16
|
+
function _interopDefault (e) { return e && e.__esModule ? e : { default: e }; }
|
|
19
17
|
|
|
20
18
|
function _interopNamespace(e) {
|
|
21
19
|
if (e && e.__esModule) return e;
|
|
@@ -31,14 +29,13 @@ function _interopNamespace(e) {
|
|
|
31
29
|
}
|
|
32
30
|
});
|
|
33
31
|
}
|
|
34
|
-
n
|
|
32
|
+
n.default = e;
|
|
35
33
|
return Object.freeze(n);
|
|
36
34
|
}
|
|
37
35
|
|
|
38
36
|
var React__namespace = /*#__PURE__*/_interopNamespace(React);
|
|
39
|
-
var
|
|
40
|
-
var
|
|
41
|
-
var styled__default = /*#__PURE__*/_interopDefaultLegacy(styled);
|
|
37
|
+
var PropTypes__default = /*#__PURE__*/_interopDefault(PropTypes);
|
|
38
|
+
var styled__default = /*#__PURE__*/_interopDefault(styled);
|
|
42
39
|
|
|
43
40
|
function _extends$4() {
|
|
44
41
|
_extends$4 = Object.assign ? Object.assign.bind() : function (target) {
|
|
@@ -56,9 +53,7 @@ function _extends$4() {
|
|
|
56
53
|
}
|
|
57
54
|
|
|
58
55
|
var _g$1;
|
|
59
|
-
|
|
60
56
|
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); }
|
|
61
|
-
|
|
62
57
|
var SvgClockStroke$1 = function SvgClockStroke(props) {
|
|
63
58
|
return /*#__PURE__*/React__namespace.createElement("svg", _extends$3({
|
|
64
59
|
xmlns: "http://www.w3.org/2000/svg",
|
|
@@ -66,8 +61,7 @@ var SvgClockStroke$1 = function SvgClockStroke(props) {
|
|
|
66
61
|
height: 12,
|
|
67
62
|
focusable: "false",
|
|
68
63
|
viewBox: "0 0 12 12",
|
|
69
|
-
"aria-hidden": "true"
|
|
70
|
-
role: "img"
|
|
64
|
+
"aria-hidden": "true"
|
|
71
65
|
}, props), _g$1 || (_g$1 = /*#__PURE__*/React__namespace.createElement("g", {
|
|
72
66
|
fill: "none",
|
|
73
67
|
stroke: "currentColor"
|
|
@@ -83,9 +77,7 @@ var SvgClockStroke$1 = function SvgClockStroke(props) {
|
|
|
83
77
|
};
|
|
84
78
|
|
|
85
79
|
var _g;
|
|
86
|
-
|
|
87
80
|
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); }
|
|
88
|
-
|
|
89
81
|
var SvgClockStroke = function SvgClockStroke(props) {
|
|
90
82
|
return /*#__PURE__*/React__namespace.createElement("svg", _extends$2({
|
|
91
83
|
xmlns: "http://www.w3.org/2000/svg",
|
|
@@ -93,8 +85,7 @@ var SvgClockStroke = function SvgClockStroke(props) {
|
|
|
93
85
|
height: 16,
|
|
94
86
|
focusable: "false",
|
|
95
87
|
viewBox: "0 0 16 16",
|
|
96
|
-
"aria-hidden": "true"
|
|
97
|
-
role: "img"
|
|
88
|
+
"aria-hidden": "true"
|
|
98
89
|
}, props), _g || (_g = /*#__PURE__*/React__namespace.createElement("g", {
|
|
99
90
|
fill: "none",
|
|
100
91
|
stroke: "currentColor"
|
|
@@ -110,9 +101,7 @@ var SvgClockStroke = function SvgClockStroke(props) {
|
|
|
110
101
|
};
|
|
111
102
|
|
|
112
103
|
var _path$1;
|
|
113
|
-
|
|
114
104
|
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); }
|
|
115
|
-
|
|
116
105
|
var SvgArrowLeftSmStroke$1 = function SvgArrowLeftSmStroke(props) {
|
|
117
106
|
return /*#__PURE__*/React__namespace.createElement("svg", _extends$1({
|
|
118
107
|
xmlns: "http://www.w3.org/2000/svg",
|
|
@@ -120,8 +109,7 @@ var SvgArrowLeftSmStroke$1 = function SvgArrowLeftSmStroke(props) {
|
|
|
120
109
|
height: 12,
|
|
121
110
|
focusable: "false",
|
|
122
111
|
viewBox: "0 0 12 12",
|
|
123
|
-
"aria-hidden": "true"
|
|
124
|
-
role: "img"
|
|
112
|
+
"aria-hidden": "true"
|
|
125
113
|
}, props), _path$1 || (_path$1 = /*#__PURE__*/React__namespace.createElement("path", {
|
|
126
114
|
fill: "currentColor",
|
|
127
115
|
d: "M2.146 6.854a.5.5 0 0 1 0-.708l2-2a.5.5 0 1 1 .708.708L3.707 6H9.5a.5.5 0 0 1 0 1H3.707l1.147 1.146a.5.5 0 1 1-.708.708l-2-2Z"
|
|
@@ -129,9 +117,7 @@ var SvgArrowLeftSmStroke$1 = function SvgArrowLeftSmStroke(props) {
|
|
|
129
117
|
};
|
|
130
118
|
|
|
131
119
|
var _path;
|
|
132
|
-
|
|
133
120
|
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); }
|
|
134
|
-
|
|
135
121
|
var SvgArrowLeftSmStroke = function SvgArrowLeftSmStroke(props) {
|
|
136
122
|
return /*#__PURE__*/React__namespace.createElement("svg", _extends({
|
|
137
123
|
xmlns: "http://www.w3.org/2000/svg",
|
|
@@ -139,8 +125,7 @@ var SvgArrowLeftSmStroke = function SvgArrowLeftSmStroke(props) {
|
|
|
139
125
|
height: 16,
|
|
140
126
|
focusable: "false",
|
|
141
127
|
viewBox: "0 0 16 16",
|
|
142
|
-
"aria-hidden": "true"
|
|
143
|
-
role: "img"
|
|
128
|
+
"aria-hidden": "true"
|
|
144
129
|
}, props), _path || (_path = /*#__PURE__*/React__namespace.createElement("path", {
|
|
145
130
|
fill: "currentColor",
|
|
146
131
|
d: "M3.146 8.854a.5.5 0 0 1 0-.708l3-3a.5.5 0 1 1 .708.708L4.707 8H12.5a.5.5 0 0 1 0 1H4.707l2.147 2.146a.5.5 0 1 1-.708.707l-3-3Z"
|
|
@@ -151,9 +136,9 @@ const SIZE = ['extraextrasmall', 'extrasmall', 'small', 'medium', 'large'];
|
|
|
151
136
|
const STATUS = ['available', 'away', 'transfers', 'offline'];
|
|
152
137
|
|
|
153
138
|
const COMPONENT_ID$6 = 'avatars.text';
|
|
154
|
-
const StyledText = styled__default
|
|
139
|
+
const StyledText = styled__default.default.span.attrs({
|
|
155
140
|
'data-garden-id': COMPONENT_ID$6,
|
|
156
|
-
'data-garden-version': '8.
|
|
141
|
+
'data-garden-version': '8.63.0'
|
|
157
142
|
}).withConfig({
|
|
158
143
|
displayName: "StyledText",
|
|
159
144
|
componentId: "sc-1a6hivh-0"
|
|
@@ -219,9 +204,9 @@ const colorStyles$2 = props => {
|
|
|
219
204
|
}
|
|
220
205
|
return styled.css(["border-color:", ";background-color:", ";color:", ";"], borderColor, backgroundColor, props.theme.palette.white);
|
|
221
206
|
};
|
|
222
|
-
const StyledStatusIndicatorBase = styled__default
|
|
207
|
+
const StyledStatusIndicatorBase = styled__default.default.div.attrs({
|
|
223
208
|
'data-garden-id': COMPONENT_ID$5,
|
|
224
|
-
'data-garden-version': '8.
|
|
209
|
+
'data-garden-version': '8.63.0'
|
|
225
210
|
}).withConfig({
|
|
226
211
|
displayName: "StyledStatusIndicatorBase",
|
|
227
212
|
componentId: "sc-1rininy-0"
|
|
@@ -258,9 +243,9 @@ const colorStyles$1 = props => {
|
|
|
258
243
|
}
|
|
259
244
|
return styled.css(["border-color:", ";box-shadow:", ";"], borderColor, boxShadow);
|
|
260
245
|
};
|
|
261
|
-
const StyledStatusIndicator = styled__default
|
|
246
|
+
const StyledStatusIndicator = styled__default.default(StyledStatusIndicatorBase).attrs({
|
|
262
247
|
'data-garden-id': COMPONENT_ID$4,
|
|
263
|
-
'data-garden-version': '8.
|
|
248
|
+
'data-garden-version': '8.63.0'
|
|
264
249
|
}).withConfig({
|
|
265
250
|
displayName: "StyledStatusIndicator",
|
|
266
251
|
componentId: "sc-16t9if3-0"
|
|
@@ -334,9 +319,9 @@ const sizeStyles$1 = props => {
|
|
|
334
319
|
}
|
|
335
320
|
return styled.css(["border-radius:", ";width:", " !important;height:", " !important;::before{box-shadow:", ";}& > svg{font-size:", ";}& ", "{line-height:", ";font-size:", ";}"], borderRadius, size, size, boxShadow, svgSize, StyledText, size, fontSize);
|
|
336
321
|
};
|
|
337
|
-
const StyledAvatar = styled__default
|
|
322
|
+
const StyledAvatar = styled__default.default.figure.attrs({
|
|
338
323
|
'data-garden-id': COMPONENT_ID$3,
|
|
339
|
-
'data-garden-version': '8.
|
|
324
|
+
'data-garden-version': '8.63.0'
|
|
340
325
|
}).withConfig({
|
|
341
326
|
displayName: "StyledAvatar",
|
|
342
327
|
componentId: "sc-608m04-0"
|
|
@@ -347,9 +332,9 @@ StyledAvatar.defaultProps = {
|
|
|
347
332
|
};
|
|
348
333
|
|
|
349
334
|
const COMPONENT_ID$2 = 'avatars.status-indicator.status';
|
|
350
|
-
const StyledStandaloneStatus = styled__default
|
|
335
|
+
const StyledStandaloneStatus = styled__default.default.figure.attrs({
|
|
351
336
|
'data-garden-id': COMPONENT_ID$2,
|
|
352
|
-
'data-garden-version': '8.
|
|
337
|
+
'data-garden-version': '8.63.0'
|
|
353
338
|
}).withConfig({
|
|
354
339
|
displayName: "StyledStandaloneStatus",
|
|
355
340
|
componentId: "sc-1ow4nfj-0"
|
|
@@ -363,9 +348,9 @@ function sizeStyles(props) {
|
|
|
363
348
|
const marginRule = `margin-${props.theme.rtl ? 'right' : 'left'}: ${props.theme.space.base * 2}px;`;
|
|
364
349
|
return styled.css(["", " line-height:", ";font-size:", ";"], marginRule, reactTheming.getLineHeight(props.theme.lineHeights.md, props.theme.fontSizes.md), props.theme.fontSizes.md);
|
|
365
350
|
}
|
|
366
|
-
const StyledStandaloneStatusCaption = styled__default
|
|
351
|
+
const StyledStandaloneStatusCaption = styled__default.default.figcaption.attrs({
|
|
367
352
|
'data-garden-id': COMPONENT_ID$1,
|
|
368
|
-
'data-garden-version': '8.
|
|
353
|
+
'data-garden-version': '8.63.0'
|
|
369
354
|
}).withConfig({
|
|
370
355
|
displayName: "StyledStandaloneStatusCaption",
|
|
371
356
|
componentId: "sc-aalyk1-0"
|
|
@@ -375,9 +360,9 @@ StyledStandaloneStatusCaption.defaultProps = {
|
|
|
375
360
|
};
|
|
376
361
|
|
|
377
362
|
const COMPONENT_ID = 'avatars.status-indicator.indicator';
|
|
378
|
-
const StyledStandaloneStatusIndicator = styled__default
|
|
363
|
+
const StyledStandaloneStatusIndicator = styled__default.default(StyledStatusIndicatorBase).attrs({
|
|
379
364
|
'data-garden-id': COMPONENT_ID,
|
|
380
|
-
'data-garden-version': '8.
|
|
365
|
+
'data-garden-version': '8.63.0'
|
|
381
366
|
}).withConfig({
|
|
382
367
|
displayName: "StyledStandaloneStatusIndicator",
|
|
383
368
|
componentId: "sc-1xt1heq-0"
|
|
@@ -387,7 +372,7 @@ StyledStandaloneStatusIndicator.defaultProps = {
|
|
|
387
372
|
theme: reactTheming.DEFAULT_THEME
|
|
388
373
|
};
|
|
389
374
|
|
|
390
|
-
const TextComponent = React.forwardRef((props, ref) =>
|
|
375
|
+
const TextComponent = React.forwardRef((props, ref) => React__namespace.default.createElement(StyledText, _extends$4({
|
|
391
376
|
ref: ref
|
|
392
377
|
}, props)));
|
|
393
378
|
TextComponent.displayName = 'Avatar.Text';
|
|
@@ -421,7 +406,7 @@ const AvatarComponent = React.forwardRef((_ref, ref) => {
|
|
|
421
406
|
return ['status'].concat(statusMessage || []).join(': ');
|
|
422
407
|
}, [computedStatus, badge]);
|
|
423
408
|
const statusLabel = reactTheming.useText(AvatarComponent, props, 'statusLabel', defaultStatusLabel);
|
|
424
|
-
return
|
|
409
|
+
return React__namespace.default.createElement(StyledAvatar, _extends$4({
|
|
425
410
|
ref: ref,
|
|
426
411
|
isSystem: isSystem,
|
|
427
412
|
size: size,
|
|
@@ -431,30 +416,30 @@ const AvatarComponent = React.forwardRef((_ref, ref) => {
|
|
|
431
416
|
foregroundColor: foregroundColor,
|
|
432
417
|
"aria-atomic": "true",
|
|
433
418
|
"aria-live": "polite"
|
|
434
|
-
}, props), React.Children.only(children), computedStatus &&
|
|
419
|
+
}, props), React.Children.only(children), computedStatus && React__namespace.default.createElement(StyledStatusIndicator, {
|
|
435
420
|
size: size,
|
|
436
421
|
type: computedStatus,
|
|
437
422
|
surfaceColor: surfaceColor,
|
|
438
423
|
"aria-label": statusLabel,
|
|
439
|
-
|
|
440
|
-
}, computedStatus === 'active' ?
|
|
424
|
+
as: "figcaption"
|
|
425
|
+
}, computedStatus === 'active' ? React__namespace.default.createElement("span", {
|
|
441
426
|
"aria-hidden": "true"
|
|
442
|
-
}, badge) :
|
|
427
|
+
}, badge) : React__namespace.default.createElement(React__namespace.default.Fragment, null, computedStatus === 'away' ? React__namespace.default.createElement(ClockIcon, {
|
|
443
428
|
"data-icon-status": computedStatus
|
|
444
|
-
}) : null, computedStatus === 'transfers' ?
|
|
429
|
+
}) : null, computedStatus === 'transfers' ? React__namespace.default.createElement(ArrowLeftIcon, {
|
|
445
430
|
"data-icon-status": computedStatus
|
|
446
431
|
}) : null)));
|
|
447
432
|
});
|
|
448
433
|
AvatarComponent.displayName = 'Avatar';
|
|
449
434
|
AvatarComponent.propTypes = {
|
|
450
|
-
backgroundColor: PropTypes__default
|
|
451
|
-
foregroundColor: PropTypes__default
|
|
452
|
-
surfaceColor: PropTypes__default
|
|
453
|
-
isSystem: PropTypes__default
|
|
454
|
-
badge: PropTypes__default
|
|
455
|
-
size: PropTypes__default
|
|
456
|
-
status: PropTypes__default
|
|
457
|
-
statusLabel: PropTypes__default
|
|
435
|
+
backgroundColor: PropTypes__default.default.string,
|
|
436
|
+
foregroundColor: PropTypes__default.default.string,
|
|
437
|
+
surfaceColor: PropTypes__default.default.string,
|
|
438
|
+
isSystem: PropTypes__default.default.bool,
|
|
439
|
+
badge: PropTypes__default.default.oneOfType([PropTypes__default.default.string, PropTypes__default.default.number]),
|
|
440
|
+
size: PropTypes__default.default.oneOf(SIZE),
|
|
441
|
+
status: PropTypes__default.default.oneOf(STATUS),
|
|
442
|
+
statusLabel: PropTypes__default.default.string
|
|
458
443
|
};
|
|
459
444
|
AvatarComponent.defaultProps = {
|
|
460
445
|
size: 'medium'
|
|
@@ -480,26 +465,28 @@ const StatusIndicator = React.forwardRef((_ref, ref) => {
|
|
|
480
465
|
const ariaLabel = reactTheming.useText(StatusIndicator, {
|
|
481
466
|
'aria-label': label
|
|
482
467
|
}, 'aria-label', defaultLabel);
|
|
483
|
-
return
|
|
484
|
-
|
|
485
|
-
|
|
486
|
-
|
|
487
|
-
|
|
488
|
-
|
|
489
|
-
|
|
490
|
-
|
|
491
|
-
|
|
492
|
-
|
|
493
|
-
|
|
494
|
-
|
|
495
|
-
|
|
496
|
-
|
|
497
|
-
|
|
468
|
+
return (
|
|
469
|
+
React__namespace.default.createElement(StyledStandaloneStatus, _extends$4({
|
|
470
|
+
role: "status",
|
|
471
|
+
ref: ref
|
|
472
|
+
}, props), React__namespace.default.createElement(StyledStandaloneStatusIndicator, {
|
|
473
|
+
role: "img",
|
|
474
|
+
type: type,
|
|
475
|
+
size: isCompact ? 'small' : 'medium',
|
|
476
|
+
"aria-label": ariaLabel
|
|
477
|
+
}, type === 'away' ? React__namespace.default.createElement(ClockIcon, {
|
|
478
|
+
"data-icon-status": type,
|
|
479
|
+
"aria-hidden": "true"
|
|
480
|
+
}) : null, type === 'transfers' ? React__namespace.default.createElement(ArrowLeftIcon, {
|
|
481
|
+
"data-icon-status": type,
|
|
482
|
+
"aria-hidden": "true"
|
|
483
|
+
}) : null), children && React__namespace.default.createElement(StyledStandaloneStatusCaption, null, children))
|
|
484
|
+
);
|
|
498
485
|
});
|
|
499
486
|
StatusIndicator.displayName = 'StatusIndicator';
|
|
500
487
|
StatusIndicator.propTypes = {
|
|
501
|
-
type: PropTypes__default
|
|
502
|
-
isCompact: PropTypes__default
|
|
488
|
+
type: PropTypes__default.default.oneOf(STATUS),
|
|
489
|
+
isCompact: PropTypes__default.default.bool
|
|
503
490
|
};
|
|
504
491
|
StatusIndicator.defaultProps = {
|
|
505
492
|
type: 'offline'
|
package/dist/index.esm.js
CHANGED
|
@@ -28,9 +28,7 @@ function _extends$4() {
|
|
|
28
28
|
}
|
|
29
29
|
|
|
30
30
|
var _g$1;
|
|
31
|
-
|
|
32
31
|
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); }
|
|
33
|
-
|
|
34
32
|
var SvgClockStroke$1 = function SvgClockStroke(props) {
|
|
35
33
|
return /*#__PURE__*/React.createElement("svg", _extends$3({
|
|
36
34
|
xmlns: "http://www.w3.org/2000/svg",
|
|
@@ -38,8 +36,7 @@ var SvgClockStroke$1 = function SvgClockStroke(props) {
|
|
|
38
36
|
height: 12,
|
|
39
37
|
focusable: "false",
|
|
40
38
|
viewBox: "0 0 12 12",
|
|
41
|
-
"aria-hidden": "true"
|
|
42
|
-
role: "img"
|
|
39
|
+
"aria-hidden": "true"
|
|
43
40
|
}, props), _g$1 || (_g$1 = /*#__PURE__*/React.createElement("g", {
|
|
44
41
|
fill: "none",
|
|
45
42
|
stroke: "currentColor"
|
|
@@ -55,9 +52,7 @@ var SvgClockStroke$1 = function SvgClockStroke(props) {
|
|
|
55
52
|
};
|
|
56
53
|
|
|
57
54
|
var _g;
|
|
58
|
-
|
|
59
55
|
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); }
|
|
60
|
-
|
|
61
56
|
var SvgClockStroke = function SvgClockStroke(props) {
|
|
62
57
|
return /*#__PURE__*/React.createElement("svg", _extends$2({
|
|
63
58
|
xmlns: "http://www.w3.org/2000/svg",
|
|
@@ -65,8 +60,7 @@ var SvgClockStroke = function SvgClockStroke(props) {
|
|
|
65
60
|
height: 16,
|
|
66
61
|
focusable: "false",
|
|
67
62
|
viewBox: "0 0 16 16",
|
|
68
|
-
"aria-hidden": "true"
|
|
69
|
-
role: "img"
|
|
63
|
+
"aria-hidden": "true"
|
|
70
64
|
}, props), _g || (_g = /*#__PURE__*/React.createElement("g", {
|
|
71
65
|
fill: "none",
|
|
72
66
|
stroke: "currentColor"
|
|
@@ -82,9 +76,7 @@ var SvgClockStroke = function SvgClockStroke(props) {
|
|
|
82
76
|
};
|
|
83
77
|
|
|
84
78
|
var _path$1;
|
|
85
|
-
|
|
86
79
|
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); }
|
|
87
|
-
|
|
88
80
|
var SvgArrowLeftSmStroke$1 = function SvgArrowLeftSmStroke(props) {
|
|
89
81
|
return /*#__PURE__*/React.createElement("svg", _extends$1({
|
|
90
82
|
xmlns: "http://www.w3.org/2000/svg",
|
|
@@ -92,8 +84,7 @@ var SvgArrowLeftSmStroke$1 = function SvgArrowLeftSmStroke(props) {
|
|
|
92
84
|
height: 12,
|
|
93
85
|
focusable: "false",
|
|
94
86
|
viewBox: "0 0 12 12",
|
|
95
|
-
"aria-hidden": "true"
|
|
96
|
-
role: "img"
|
|
87
|
+
"aria-hidden": "true"
|
|
97
88
|
}, props), _path$1 || (_path$1 = /*#__PURE__*/React.createElement("path", {
|
|
98
89
|
fill: "currentColor",
|
|
99
90
|
d: "M2.146 6.854a.5.5 0 0 1 0-.708l2-2a.5.5 0 1 1 .708.708L3.707 6H9.5a.5.5 0 0 1 0 1H3.707l1.147 1.146a.5.5 0 1 1-.708.708l-2-2Z"
|
|
@@ -101,9 +92,7 @@ var SvgArrowLeftSmStroke$1 = function SvgArrowLeftSmStroke(props) {
|
|
|
101
92
|
};
|
|
102
93
|
|
|
103
94
|
var _path;
|
|
104
|
-
|
|
105
95
|
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); }
|
|
106
|
-
|
|
107
96
|
var SvgArrowLeftSmStroke = function SvgArrowLeftSmStroke(props) {
|
|
108
97
|
return /*#__PURE__*/React.createElement("svg", _extends({
|
|
109
98
|
xmlns: "http://www.w3.org/2000/svg",
|
|
@@ -111,8 +100,7 @@ var SvgArrowLeftSmStroke = function SvgArrowLeftSmStroke(props) {
|
|
|
111
100
|
height: 16,
|
|
112
101
|
focusable: "false",
|
|
113
102
|
viewBox: "0 0 16 16",
|
|
114
|
-
"aria-hidden": "true"
|
|
115
|
-
role: "img"
|
|
103
|
+
"aria-hidden": "true"
|
|
116
104
|
}, props), _path || (_path = /*#__PURE__*/React.createElement("path", {
|
|
117
105
|
fill: "currentColor",
|
|
118
106
|
d: "M3.146 8.854a.5.5 0 0 1 0-.708l3-3a.5.5 0 1 1 .708.708L4.707 8H12.5a.5.5 0 0 1 0 1H4.707l2.147 2.146a.5.5 0 1 1-.708.707l-3-3Z"
|
|
@@ -125,7 +113,7 @@ const STATUS = ['available', 'away', 'transfers', 'offline'];
|
|
|
125
113
|
const COMPONENT_ID$6 = 'avatars.text';
|
|
126
114
|
const StyledText = styled.span.attrs({
|
|
127
115
|
'data-garden-id': COMPONENT_ID$6,
|
|
128
|
-
'data-garden-version': '8.
|
|
116
|
+
'data-garden-version': '8.63.0'
|
|
129
117
|
}).withConfig({
|
|
130
118
|
displayName: "StyledText",
|
|
131
119
|
componentId: "sc-1a6hivh-0"
|
|
@@ -193,7 +181,7 @@ const colorStyles$2 = props => {
|
|
|
193
181
|
};
|
|
194
182
|
const StyledStatusIndicatorBase = styled.div.attrs({
|
|
195
183
|
'data-garden-id': COMPONENT_ID$5,
|
|
196
|
-
'data-garden-version': '8.
|
|
184
|
+
'data-garden-version': '8.63.0'
|
|
197
185
|
}).withConfig({
|
|
198
186
|
displayName: "StyledStatusIndicatorBase",
|
|
199
187
|
componentId: "sc-1rininy-0"
|
|
@@ -232,7 +220,7 @@ const colorStyles$1 = props => {
|
|
|
232
220
|
};
|
|
233
221
|
const StyledStatusIndicator = styled(StyledStatusIndicatorBase).attrs({
|
|
234
222
|
'data-garden-id': COMPONENT_ID$4,
|
|
235
|
-
'data-garden-version': '8.
|
|
223
|
+
'data-garden-version': '8.63.0'
|
|
236
224
|
}).withConfig({
|
|
237
225
|
displayName: "StyledStatusIndicator",
|
|
238
226
|
componentId: "sc-16t9if3-0"
|
|
@@ -308,7 +296,7 @@ const sizeStyles$1 = props => {
|
|
|
308
296
|
};
|
|
309
297
|
const StyledAvatar = styled.figure.attrs({
|
|
310
298
|
'data-garden-id': COMPONENT_ID$3,
|
|
311
|
-
'data-garden-version': '8.
|
|
299
|
+
'data-garden-version': '8.63.0'
|
|
312
300
|
}).withConfig({
|
|
313
301
|
displayName: "StyledAvatar",
|
|
314
302
|
componentId: "sc-608m04-0"
|
|
@@ -321,7 +309,7 @@ StyledAvatar.defaultProps = {
|
|
|
321
309
|
const COMPONENT_ID$2 = 'avatars.status-indicator.status';
|
|
322
310
|
const StyledStandaloneStatus = styled.figure.attrs({
|
|
323
311
|
'data-garden-id': COMPONENT_ID$2,
|
|
324
|
-
'data-garden-version': '8.
|
|
312
|
+
'data-garden-version': '8.63.0'
|
|
325
313
|
}).withConfig({
|
|
326
314
|
displayName: "StyledStandaloneStatus",
|
|
327
315
|
componentId: "sc-1ow4nfj-0"
|
|
@@ -337,7 +325,7 @@ function sizeStyles(props) {
|
|
|
337
325
|
}
|
|
338
326
|
const StyledStandaloneStatusCaption = styled.figcaption.attrs({
|
|
339
327
|
'data-garden-id': COMPONENT_ID$1,
|
|
340
|
-
'data-garden-version': '8.
|
|
328
|
+
'data-garden-version': '8.63.0'
|
|
341
329
|
}).withConfig({
|
|
342
330
|
displayName: "StyledStandaloneStatusCaption",
|
|
343
331
|
componentId: "sc-aalyk1-0"
|
|
@@ -349,7 +337,7 @@ StyledStandaloneStatusCaption.defaultProps = {
|
|
|
349
337
|
const COMPONENT_ID = 'avatars.status-indicator.indicator';
|
|
350
338
|
const StyledStandaloneStatusIndicator = styled(StyledStatusIndicatorBase).attrs({
|
|
351
339
|
'data-garden-id': COMPONENT_ID,
|
|
352
|
-
'data-garden-version': '8.
|
|
340
|
+
'data-garden-version': '8.63.0'
|
|
353
341
|
}).withConfig({
|
|
354
342
|
displayName: "StyledStandaloneStatusIndicator",
|
|
355
343
|
componentId: "sc-1xt1heq-0"
|
|
@@ -408,7 +396,7 @@ const AvatarComponent = forwardRef((_ref, ref) => {
|
|
|
408
396
|
type: computedStatus,
|
|
409
397
|
surfaceColor: surfaceColor,
|
|
410
398
|
"aria-label": statusLabel,
|
|
411
|
-
|
|
399
|
+
as: "figcaption"
|
|
412
400
|
}, computedStatus === 'active' ? React__default.createElement("span", {
|
|
413
401
|
"aria-hidden": "true"
|
|
414
402
|
}, badge) : React__default.createElement(React__default.Fragment, null, computedStatus === 'away' ? React__default.createElement(ClockIcon, {
|
|
@@ -452,21 +440,23 @@ const StatusIndicator = forwardRef((_ref, ref) => {
|
|
|
452
440
|
const ariaLabel = useText(StatusIndicator, {
|
|
453
441
|
'aria-label': label
|
|
454
442
|
}, 'aria-label', defaultLabel);
|
|
455
|
-
return
|
|
456
|
-
|
|
457
|
-
|
|
458
|
-
|
|
459
|
-
|
|
460
|
-
|
|
461
|
-
|
|
462
|
-
|
|
463
|
-
|
|
464
|
-
|
|
465
|
-
|
|
466
|
-
|
|
467
|
-
|
|
468
|
-
|
|
469
|
-
|
|
443
|
+
return (
|
|
444
|
+
React__default.createElement(StyledStandaloneStatus, _extends$4({
|
|
445
|
+
role: "status",
|
|
446
|
+
ref: ref
|
|
447
|
+
}, props), React__default.createElement(StyledStandaloneStatusIndicator, {
|
|
448
|
+
role: "img",
|
|
449
|
+
type: type,
|
|
450
|
+
size: isCompact ? 'small' : 'medium',
|
|
451
|
+
"aria-label": ariaLabel
|
|
452
|
+
}, type === 'away' ? React__default.createElement(ClockIcon, {
|
|
453
|
+
"data-icon-status": type,
|
|
454
|
+
"aria-hidden": "true"
|
|
455
|
+
}) : null, type === 'transfers' ? React__default.createElement(ArrowLeftIcon, {
|
|
456
|
+
"data-icon-status": type,
|
|
457
|
+
"aria-hidden": "true"
|
|
458
|
+
}) : null), children && React__default.createElement(StyledStandaloneStatusCaption, null, children))
|
|
459
|
+
);
|
|
470
460
|
});
|
|
471
461
|
StatusIndicator.displayName = 'StatusIndicator';
|
|
472
462
|
StatusIndicator.propTypes = {
|
|
@@ -6,6 +6,12 @@
|
|
|
6
6
|
*/
|
|
7
7
|
import React from 'react';
|
|
8
8
|
import { IStatusIndicatorProps } from '../types';
|
|
9
|
+
/**
|
|
10
|
+
* 1. role='status' on `div` is valid WAI-ARIA usage in this context.
|
|
11
|
+
* https://www.w3.org/TR/wai-aria-1.1/#status
|
|
12
|
+
* 2. role='img' on `svg` is valid WAI-ARIA usage in this context.
|
|
13
|
+
* https://dequeuniversity.com/rules/axe/4.2/svg-img-alt
|
|
14
|
+
*/
|
|
9
15
|
/**
|
|
10
16
|
* @extends HTMLAttributes<HTMLElement>
|
|
11
17
|
*/
|
|
@@ -17,9 +17,9 @@ export interface IAvatarProps extends HTMLAttributes<HTMLElement> {
|
|
|
17
17
|
/** Applies system styling for representing objects, brands, or products */
|
|
18
18
|
isSystem?: boolean;
|
|
19
19
|
/** Specifies the avatar size */
|
|
20
|
-
size?: typeof SIZE[number];
|
|
20
|
+
size?: (typeof SIZE)[number];
|
|
21
21
|
/** Applies status styling */
|
|
22
|
-
status?: typeof STATUS[number];
|
|
22
|
+
status?: (typeof STATUS)[number];
|
|
23
23
|
/** Specifies the status label */
|
|
24
24
|
statusLabel?: string;
|
|
25
25
|
/** Sets the badge text and applies active styling */
|
|
@@ -27,7 +27,7 @@ export interface IAvatarProps extends HTMLAttributes<HTMLElement> {
|
|
|
27
27
|
}
|
|
28
28
|
export interface IStatusIndicatorProps extends HTMLAttributes<HTMLElement> {
|
|
29
29
|
/** Applies status type for styling and default aria-label */
|
|
30
|
-
type?: typeof STATUS[number];
|
|
30
|
+
type?: (typeof STATUS)[number];
|
|
31
31
|
/** Applies compact styling */
|
|
32
32
|
isCompact?: boolean;
|
|
33
33
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@zendeskgarden/react-avatars",
|
|
3
|
-
"version": "8.
|
|
3
|
+
"version": "8.63.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>",
|
|
@@ -31,7 +31,7 @@
|
|
|
31
31
|
"styled-components": "^4.2.0 || ^5.0.0"
|
|
32
32
|
},
|
|
33
33
|
"devDependencies": {
|
|
34
|
-
"@zendeskgarden/react-theming": "^8.
|
|
34
|
+
"@zendeskgarden/react-theming": "^8.63.0",
|
|
35
35
|
"@zendeskgarden/svg-icons": "6.33.0"
|
|
36
36
|
},
|
|
37
37
|
"keywords": [
|
|
@@ -44,5 +44,5 @@
|
|
|
44
44
|
"access": "public"
|
|
45
45
|
},
|
|
46
46
|
"zendeskgarden:src": "src/index.ts",
|
|
47
|
-
"gitHead": "
|
|
47
|
+
"gitHead": "4b8715305a769881b143c7195c5b31e687422926"
|
|
48
48
|
}
|