@zendeskgarden/react-avatars 8.57.0 → 8.58.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 +148 -281
- package/dist/index.esm.js +148 -281
- package/dist/typings/elements/StatusIndicator.d.ts +3 -0
- package/package.json +3 -3
package/dist/index.cjs.js
CHANGED
|
@@ -44,114 +44,17 @@ function _extends$4() {
|
|
|
44
44
|
_extends$4 = Object.assign ? Object.assign.bind() : function (target) {
|
|
45
45
|
for (var i = 1; i < arguments.length; i++) {
|
|
46
46
|
var source = arguments[i];
|
|
47
|
-
|
|
48
47
|
for (var key in source) {
|
|
49
48
|
if (Object.prototype.hasOwnProperty.call(source, key)) {
|
|
50
49
|
target[key] = source[key];
|
|
51
50
|
}
|
|
52
51
|
}
|
|
53
52
|
}
|
|
54
|
-
|
|
55
53
|
return target;
|
|
56
54
|
};
|
|
57
55
|
return _extends$4.apply(this, arguments);
|
|
58
56
|
}
|
|
59
57
|
|
|
60
|
-
function _objectWithoutPropertiesLoose(source, excluded) {
|
|
61
|
-
if (source == null) return {};
|
|
62
|
-
var target = {};
|
|
63
|
-
var sourceKeys = Object.keys(source);
|
|
64
|
-
var key, i;
|
|
65
|
-
|
|
66
|
-
for (i = 0; i < sourceKeys.length; i++) {
|
|
67
|
-
key = sourceKeys[i];
|
|
68
|
-
if (excluded.indexOf(key) >= 0) continue;
|
|
69
|
-
target[key] = source[key];
|
|
70
|
-
}
|
|
71
|
-
|
|
72
|
-
return target;
|
|
73
|
-
}
|
|
74
|
-
|
|
75
|
-
function _objectWithoutProperties(source, excluded) {
|
|
76
|
-
if (source == null) return {};
|
|
77
|
-
|
|
78
|
-
var target = _objectWithoutPropertiesLoose(source, excluded);
|
|
79
|
-
|
|
80
|
-
var key, i;
|
|
81
|
-
|
|
82
|
-
if (Object.getOwnPropertySymbols) {
|
|
83
|
-
var sourceSymbolKeys = Object.getOwnPropertySymbols(source);
|
|
84
|
-
|
|
85
|
-
for (i = 0; i < sourceSymbolKeys.length; i++) {
|
|
86
|
-
key = sourceSymbolKeys[i];
|
|
87
|
-
if (excluded.indexOf(key) >= 0) continue;
|
|
88
|
-
if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue;
|
|
89
|
-
target[key] = source[key];
|
|
90
|
-
}
|
|
91
|
-
}
|
|
92
|
-
|
|
93
|
-
return target;
|
|
94
|
-
}
|
|
95
|
-
|
|
96
|
-
function _slicedToArray(arr, i) {
|
|
97
|
-
return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest();
|
|
98
|
-
}
|
|
99
|
-
|
|
100
|
-
function _arrayWithHoles(arr) {
|
|
101
|
-
if (Array.isArray(arr)) return arr;
|
|
102
|
-
}
|
|
103
|
-
|
|
104
|
-
function _iterableToArrayLimit(arr, i) {
|
|
105
|
-
var _i = arr == null ? null : typeof Symbol !== "undefined" && arr[Symbol.iterator] || arr["@@iterator"];
|
|
106
|
-
|
|
107
|
-
if (_i == null) return;
|
|
108
|
-
var _arr = [];
|
|
109
|
-
var _n = true;
|
|
110
|
-
var _d = false;
|
|
111
|
-
|
|
112
|
-
var _s, _e;
|
|
113
|
-
|
|
114
|
-
try {
|
|
115
|
-
for (_i = _i.call(arr); !(_n = (_s = _i.next()).done); _n = true) {
|
|
116
|
-
_arr.push(_s.value);
|
|
117
|
-
|
|
118
|
-
if (i && _arr.length === i) break;
|
|
119
|
-
}
|
|
120
|
-
} catch (err) {
|
|
121
|
-
_d = true;
|
|
122
|
-
_e = err;
|
|
123
|
-
} finally {
|
|
124
|
-
try {
|
|
125
|
-
if (!_n && _i["return"] != null) _i["return"]();
|
|
126
|
-
} finally {
|
|
127
|
-
if (_d) throw _e;
|
|
128
|
-
}
|
|
129
|
-
}
|
|
130
|
-
|
|
131
|
-
return _arr;
|
|
132
|
-
}
|
|
133
|
-
|
|
134
|
-
function _unsupportedIterableToArray(o, minLen) {
|
|
135
|
-
if (!o) return;
|
|
136
|
-
if (typeof o === "string") return _arrayLikeToArray(o, minLen);
|
|
137
|
-
var n = Object.prototype.toString.call(o).slice(8, -1);
|
|
138
|
-
if (n === "Object" && o.constructor) n = o.constructor.name;
|
|
139
|
-
if (n === "Map" || n === "Set") return Array.from(o);
|
|
140
|
-
if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen);
|
|
141
|
-
}
|
|
142
|
-
|
|
143
|
-
function _arrayLikeToArray(arr, len) {
|
|
144
|
-
if (len == null || len > arr.length) len = arr.length;
|
|
145
|
-
|
|
146
|
-
for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i];
|
|
147
|
-
|
|
148
|
-
return arr2;
|
|
149
|
-
}
|
|
150
|
-
|
|
151
|
-
function _nonIterableRest() {
|
|
152
|
-
throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
|
|
153
|
-
}
|
|
154
|
-
|
|
155
58
|
var _g$1;
|
|
156
59
|
|
|
157
60
|
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); }
|
|
@@ -163,7 +66,8 @@ var SvgClockStroke$1 = function SvgClockStroke(props) {
|
|
|
163
66
|
height: 12,
|
|
164
67
|
focusable: "false",
|
|
165
68
|
viewBox: "0 0 12 12",
|
|
166
|
-
"aria-hidden": "true"
|
|
69
|
+
"aria-hidden": "true",
|
|
70
|
+
role: "img"
|
|
167
71
|
}, props), _g$1 || (_g$1 = /*#__PURE__*/React__namespace.createElement("g", {
|
|
168
72
|
fill: "none",
|
|
169
73
|
stroke: "currentColor"
|
|
@@ -189,7 +93,8 @@ var SvgClockStroke = function SvgClockStroke(props) {
|
|
|
189
93
|
height: 16,
|
|
190
94
|
focusable: "false",
|
|
191
95
|
viewBox: "0 0 16 16",
|
|
192
|
-
"aria-hidden": "true"
|
|
96
|
+
"aria-hidden": "true",
|
|
97
|
+
role: "img"
|
|
193
98
|
}, props), _g || (_g = /*#__PURE__*/React__namespace.createElement("g", {
|
|
194
99
|
fill: "none",
|
|
195
100
|
stroke: "currentColor"
|
|
@@ -215,7 +120,8 @@ var SvgArrowLeftSmStroke$1 = function SvgArrowLeftSmStroke(props) {
|
|
|
215
120
|
height: 12,
|
|
216
121
|
focusable: "false",
|
|
217
122
|
viewBox: "0 0 12 12",
|
|
218
|
-
"aria-hidden": "true"
|
|
123
|
+
"aria-hidden": "true",
|
|
124
|
+
role: "img"
|
|
219
125
|
}, props), _path$1 || (_path$1 = /*#__PURE__*/React__namespace.createElement("path", {
|
|
220
126
|
fill: "currentColor",
|
|
221
127
|
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"
|
|
@@ -233,37 +139,31 @@ var SvgArrowLeftSmStroke = function SvgArrowLeftSmStroke(props) {
|
|
|
233
139
|
height: 16,
|
|
234
140
|
focusable: "false",
|
|
235
141
|
viewBox: "0 0 16 16",
|
|
236
|
-
"aria-hidden": "true"
|
|
142
|
+
"aria-hidden": "true",
|
|
143
|
+
role: "img"
|
|
237
144
|
}, props), _path || (_path = /*#__PURE__*/React__namespace.createElement("path", {
|
|
238
145
|
fill: "currentColor",
|
|
239
146
|
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"
|
|
240
147
|
})));
|
|
241
148
|
};
|
|
242
149
|
|
|
243
|
-
|
|
244
|
-
|
|
150
|
+
const SIZE = ['extraextrasmall', 'extrasmall', 'small', 'medium', 'large'];
|
|
151
|
+
const STATUS = ['available', 'away', 'transfers', 'offline'];
|
|
245
152
|
|
|
246
|
-
|
|
247
|
-
|
|
153
|
+
const COMPONENT_ID$6 = 'avatars.text';
|
|
154
|
+
const StyledText = styled__default["default"].span.attrs({
|
|
248
155
|
'data-garden-id': COMPONENT_ID$6,
|
|
249
|
-
'data-garden-version': '8.
|
|
156
|
+
'data-garden-version': '8.58.0'
|
|
250
157
|
}).withConfig({
|
|
251
158
|
displayName: "StyledText",
|
|
252
159
|
componentId: "sc-1a6hivh-0"
|
|
253
|
-
})(["overflow:hidden;text-align:center;white-space:nowrap;", ";"],
|
|
254
|
-
return reactTheming.retrieveComponentStyles(COMPONENT_ID$6, props);
|
|
255
|
-
});
|
|
160
|
+
})(["overflow:hidden;text-align:center;white-space:nowrap;", ";"], props => reactTheming.retrieveComponentStyles(COMPONENT_ID$6, props));
|
|
256
161
|
StyledText.defaultProps = {
|
|
257
162
|
theme: reactTheming.DEFAULT_THEME
|
|
258
163
|
};
|
|
259
164
|
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
xs$1 = _SIZE$1[1],
|
|
263
|
-
s$1 = _SIZE$1[2],
|
|
264
|
-
m$1 = _SIZE$1[3],
|
|
265
|
-
l$1 = _SIZE$1[4];
|
|
266
|
-
var TRANSITION_DURATION = 0.25;
|
|
165
|
+
const [xxs$1, xs$1, s$1, m$1, l$1] = SIZE;
|
|
166
|
+
const TRANSITION_DURATION = 0.25;
|
|
267
167
|
function getStatusColor(type, theme) {
|
|
268
168
|
switch (type) {
|
|
269
169
|
case 'active':
|
|
@@ -281,20 +181,20 @@ function getStatusColor(type, theme) {
|
|
|
281
181
|
}
|
|
282
182
|
}
|
|
283
183
|
function getStatusBorderOffset(props) {
|
|
284
|
-
return props.size === xxs$1 ? polished.math(
|
|
184
|
+
return props.size === xxs$1 ? polished.math(`${props.theme.shadowWidths.sm} - 1`) : props.theme.shadowWidths.sm;
|
|
285
185
|
}
|
|
286
186
|
function getStatusSize(props, offset) {
|
|
287
|
-
|
|
187
|
+
const isActive = props.type === 'active';
|
|
288
188
|
switch (props.size) {
|
|
289
189
|
case xxs$1:
|
|
290
|
-
return polished.math(
|
|
190
|
+
return polished.math(`${props.theme.space.base}px - ${offset}`);
|
|
291
191
|
case xs$1:
|
|
292
|
-
return polished.math(
|
|
192
|
+
return polished.math(`${props.theme.space.base * 2}px - (${offset} * 2)`);
|
|
293
193
|
case s$1:
|
|
294
|
-
return polished.math(
|
|
194
|
+
return polished.math(`${props.theme.space.base * 3}px ${isActive ? '' : `- (${offset} * 2)`}`);
|
|
295
195
|
case m$1:
|
|
296
196
|
case l$1:
|
|
297
|
-
return polished.math(
|
|
197
|
+
return polished.math(`${props.theme.space.base * 4}px ${isActive ? '' : `- (${offset} * 2)`}`);
|
|
298
198
|
default:
|
|
299
199
|
return '0';
|
|
300
200
|
}
|
|
@@ -303,253 +203,224 @@ function includes(array, element) {
|
|
|
303
203
|
return array.includes(element);
|
|
304
204
|
}
|
|
305
205
|
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
206
|
+
const COMPONENT_ID$5 = 'avatars.status-indicator.base';
|
|
207
|
+
const iconFadeIn = styled.keyframes(["0%{opacity:0;}100%{opacity:1;}"]);
|
|
208
|
+
const sizeStyles$3 = props => {
|
|
209
|
+
const offset = getStatusBorderOffset(props);
|
|
210
|
+
const size = getStatusSize(props, offset);
|
|
311
211
|
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);
|
|
312
212
|
};
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
213
|
+
const colorStyles$2 = props => {
|
|
214
|
+
let backgroundColor = getStatusColor(props.type, props.theme);
|
|
215
|
+
let borderColor = backgroundColor;
|
|
316
216
|
if (props.type === 'offline') {
|
|
317
217
|
borderColor = getStatusColor(props.type, props.theme);
|
|
318
218
|
backgroundColor = props.theme.palette.white;
|
|
319
219
|
}
|
|
320
220
|
return styled.css(["border-color:", ";background-color:", ";color:", ";"], borderColor, backgroundColor, props.theme.palette.white);
|
|
321
221
|
};
|
|
322
|
-
|
|
222
|
+
const StyledStatusIndicatorBase = styled__default["default"].div.attrs({
|
|
323
223
|
'data-garden-id': COMPONENT_ID$5,
|
|
324
|
-
'data-garden-version': '8.
|
|
224
|
+
'data-garden-version': '8.58.0'
|
|
325
225
|
}).withConfig({
|
|
326
226
|
displayName: "StyledStatusIndicatorBase",
|
|
327
227
|
componentId: "sc-1rininy-0"
|
|
328
|
-
})(["transition:inherit;", " ", " ", ";"], sizeStyles$3, colorStyles$2,
|
|
329
|
-
return reactTheming.retrieveComponentStyles(COMPONENT_ID$5, props);
|
|
330
|
-
});
|
|
228
|
+
})(["transition:inherit;", " ", " ", ";"], sizeStyles$3, colorStyles$2, props => reactTheming.retrieveComponentStyles(COMPONENT_ID$5, props));
|
|
331
229
|
StyledStatusIndicatorBase.defaultProps = {
|
|
332
230
|
theme: reactTheming.DEFAULT_THEME,
|
|
333
231
|
size: 'small'
|
|
334
232
|
};
|
|
335
233
|
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
l = _SIZE[4];
|
|
343
|
-
var sizeStyles$2 = function sizeStyles(props) {
|
|
344
|
-
var isVisible = !includes([xxs, xs], props.size);
|
|
345
|
-
var borderWidth = getStatusBorderOffset(props);
|
|
346
|
-
var padding = '0';
|
|
234
|
+
const COMPONENT_ID$4 = 'avatars.status_indicator';
|
|
235
|
+
const [xxs, xs, s, m, l] = SIZE;
|
|
236
|
+
const sizeStyles$2 = props => {
|
|
237
|
+
const isVisible = !includes([xxs, xs], props.size);
|
|
238
|
+
const borderWidth = getStatusBorderOffset(props);
|
|
239
|
+
let padding = '0';
|
|
347
240
|
if (props.size === s) {
|
|
348
|
-
padding = polished.math(
|
|
241
|
+
padding = polished.math(`${props.theme.space.base + 1}px - (${borderWidth} * 2)`);
|
|
349
242
|
} else if (includes([m, l], props.size)) {
|
|
350
|
-
padding = polished.math(
|
|
243
|
+
padding = polished.math(`${props.theme.space.base + 3}px - (${borderWidth} * 2)`);
|
|
351
244
|
}
|
|
352
245
|
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;');
|
|
353
246
|
};
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
|
|
247
|
+
const colorStyles$1 = props => {
|
|
248
|
+
const {
|
|
249
|
+
theme,
|
|
250
|
+
type,
|
|
251
|
+
size,
|
|
252
|
+
borderColor,
|
|
253
|
+
surfaceColor
|
|
254
|
+
} = props;
|
|
255
|
+
let boxShadow = theme.shadows.sm(surfaceColor || (type ? theme.colors.background : theme.palette.white));
|
|
363
256
|
if (size === xxs) {
|
|
364
257
|
boxShadow = boxShadow.replace(theme.shadowWidths.sm, '1px');
|
|
365
258
|
}
|
|
366
|
-
return styled.css(["border-color:", ";box-shadow:", ";
|
|
259
|
+
return styled.css(["border-color:", ";box-shadow:", ";"], borderColor, boxShadow);
|
|
367
260
|
};
|
|
368
|
-
|
|
261
|
+
const StyledStatusIndicator = styled__default["default"](StyledStatusIndicatorBase).attrs({
|
|
369
262
|
'data-garden-id': COMPONENT_ID$4,
|
|
370
|
-
'data-garden-version': '8.
|
|
263
|
+
'data-garden-version': '8.58.0'
|
|
371
264
|
}).withConfig({
|
|
372
265
|
displayName: "StyledStatusIndicator",
|
|
373
266
|
componentId: "sc-16t9if3-0"
|
|
374
|
-
})(["", " ", " ", ";"], sizeStyles$2, colorStyles$1,
|
|
375
|
-
return reactTheming.retrieveComponentStyles(COMPONENT_ID$4, props);
|
|
376
|
-
});
|
|
267
|
+
})(["", " ", " ", ";"], sizeStyles$2, colorStyles$1, props => reactTheming.retrieveComponentStyles(COMPONENT_ID$4, props));
|
|
377
268
|
StyledStatusIndicator.defaultProps = {
|
|
378
269
|
size: 'medium',
|
|
379
270
|
theme: reactTheming.DEFAULT_THEME
|
|
380
271
|
};
|
|
381
272
|
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
|
|
385
|
-
|
|
386
|
-
xs = _SIZE[1],
|
|
387
|
-
s = _SIZE[2],
|
|
388
|
-
m = _SIZE[3],
|
|
389
|
-
l = _SIZE[4];
|
|
390
|
-
var position = "".concat(props.theme.space.base * -1, "px");
|
|
273
|
+
const COMPONENT_ID$3 = 'avatars.avatar';
|
|
274
|
+
const badgeStyles = props => {
|
|
275
|
+
const [xxs, xs, s, m, l] = SIZE;
|
|
276
|
+
let position = `${props.theme.space.base * -1}px`;
|
|
391
277
|
switch (props.size) {
|
|
392
278
|
case s:
|
|
393
279
|
case m:
|
|
394
|
-
position = polished.math(
|
|
280
|
+
position = polished.math(`${position} + 2`);
|
|
395
281
|
break;
|
|
396
282
|
case xxs:
|
|
397
283
|
case xs:
|
|
398
284
|
case l:
|
|
399
|
-
position = polished.math(
|
|
285
|
+
position = polished.math(`${position} + 3`);
|
|
400
286
|
break;
|
|
401
287
|
}
|
|
402
|
-
|
|
288
|
+
const animation = styled.keyframes(["0%{transform:scale(.1);}"]);
|
|
403
289
|
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));
|
|
404
290
|
};
|
|
405
|
-
|
|
406
|
-
|
|
407
|
-
|
|
408
|
-
|
|
409
|
-
|
|
291
|
+
const colorStyles = props => {
|
|
292
|
+
const statusColor = getStatusColor(props.status, props.theme);
|
|
293
|
+
const backgroundColor = props.backgroundColor || 'transparent';
|
|
294
|
+
const foregroundColor = props.foregroundColor || props.theme.palette.white;
|
|
295
|
+
const surfaceColor = props.status ? props.surfaceColor || props.theme.colors.background : 'transparent';
|
|
410
296
|
return styled.css(["box-shadow:", ";background-color:", ";color:", ";& > svg,& ", "{color:", ";}"], props.theme.shadows.sm(statusColor), backgroundColor, surfaceColor, StyledText, foregroundColor);
|
|
411
297
|
};
|
|
412
|
-
|
|
413
|
-
|
|
414
|
-
|
|
415
|
-
|
|
416
|
-
|
|
417
|
-
|
|
298
|
+
const sizeStyles$1 = props => {
|
|
299
|
+
let boxShadow;
|
|
300
|
+
let borderRadius;
|
|
301
|
+
let size;
|
|
302
|
+
let fontSize;
|
|
303
|
+
let svgSize;
|
|
418
304
|
if (props.size === 'extraextrasmall') {
|
|
419
|
-
boxShadow =
|
|
420
|
-
borderRadius = props.isSystem ? polished.math(
|
|
421
|
-
size =
|
|
305
|
+
boxShadow = `0 0 0 ${polished.math(`${props.theme.shadowWidths.sm} - 1`)}`;
|
|
306
|
+
borderRadius = props.isSystem ? polished.math(`${props.theme.borderRadii.md} - 1`) : '50%';
|
|
307
|
+
size = `${props.theme.space.base * 4}px`;
|
|
422
308
|
fontSize = 0;
|
|
423
|
-
svgSize =
|
|
309
|
+
svgSize = `${props.theme.space.base * 3}px`;
|
|
424
310
|
} else if (props.size === 'extrasmall') {
|
|
425
|
-
boxShadow =
|
|
426
|
-
borderRadius = props.isSystem ? polished.math(
|
|
427
|
-
size =
|
|
311
|
+
boxShadow = `inset 0 0 0 ${props.theme.shadowWidths.sm}`;
|
|
312
|
+
borderRadius = props.isSystem ? polished.math(`${props.theme.borderRadii.md} - 1`) : '50%';
|
|
313
|
+
size = `${props.theme.space.base * 6}px`;
|
|
428
314
|
fontSize = props.theme.fontSizes.sm;
|
|
429
|
-
svgSize =
|
|
315
|
+
svgSize = `${props.theme.space.base * 3}px`;
|
|
430
316
|
} else if (props.size === 'small') {
|
|
431
|
-
boxShadow =
|
|
432
|
-
borderRadius = props.isSystem ? polished.math(
|
|
433
|
-
size =
|
|
317
|
+
boxShadow = `inset 0 0 0 ${props.theme.shadowWidths.sm}`;
|
|
318
|
+
borderRadius = props.isSystem ? polished.math(`${props.theme.borderRadii.md} - 1`) : '50%';
|
|
319
|
+
size = `${props.theme.space.base * 8}px`;
|
|
434
320
|
fontSize = props.theme.fontSizes.md;
|
|
435
|
-
svgSize =
|
|
321
|
+
svgSize = `${props.theme.space.base * 3}px`;
|
|
436
322
|
} else if (props.size === 'large') {
|
|
437
|
-
boxShadow =
|
|
438
|
-
borderRadius = props.isSystem ? polished.math(
|
|
439
|
-
size =
|
|
323
|
+
boxShadow = `inset 0 0 0 ${props.theme.shadowWidths.sm}`;
|
|
324
|
+
borderRadius = props.isSystem ? polished.math(`${props.theme.borderRadii.md} + 1`) : '50%';
|
|
325
|
+
size = `${props.theme.space.base * 12}px`;
|
|
440
326
|
fontSize = props.theme.fontSizes.xl;
|
|
441
|
-
svgSize =
|
|
327
|
+
svgSize = `${props.theme.space.base * 6}px`;
|
|
442
328
|
} else {
|
|
443
|
-
boxShadow =
|
|
329
|
+
boxShadow = `inset 0 0 0 ${props.theme.shadowWidths.sm}`;
|
|
444
330
|
borderRadius = props.isSystem ? props.theme.borderRadii.md : '50%';
|
|
445
|
-
size =
|
|
331
|
+
size = `${props.theme.space.base * 10}px`;
|
|
446
332
|
fontSize = props.theme.fontSizes.lg;
|
|
447
|
-
svgSize =
|
|
333
|
+
svgSize = `${props.theme.space.base * 4}px`;
|
|
448
334
|
}
|
|
449
335
|
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);
|
|
450
336
|
};
|
|
451
|
-
|
|
337
|
+
const StyledAvatar = styled__default["default"].figure.attrs({
|
|
452
338
|
'data-garden-id': COMPONENT_ID$3,
|
|
453
|
-
'data-garden-version': '8.
|
|
339
|
+
'data-garden-version': '8.58.0'
|
|
454
340
|
}).withConfig({
|
|
455
341
|
displayName: "StyledAvatar",
|
|
456
342
|
componentId: "sc-608m04-0"
|
|
457
|
-
})(["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,
|
|
458
|
-
return sizeStyles$1(props);
|
|
459
|
-
}, function (props) {
|
|
460
|
-
return colorStyles(props);
|
|
461
|
-
}, TRANSITION_DURATION, StyledStatusIndicator, badgeStyles, function (props) {
|
|
462
|
-
return reactTheming.retrieveComponentStyles(COMPONENT_ID$3, props);
|
|
463
|
-
});
|
|
343
|
+
})(["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));
|
|
464
344
|
StyledAvatar.defaultProps = {
|
|
465
345
|
size: 'medium',
|
|
466
346
|
theme: reactTheming.DEFAULT_THEME
|
|
467
347
|
};
|
|
468
348
|
|
|
469
|
-
|
|
470
|
-
|
|
349
|
+
const COMPONENT_ID$2 = 'avatars.status-indicator.status';
|
|
350
|
+
const StyledStandaloneStatus = styled__default["default"].figure.attrs({
|
|
471
351
|
'data-garden-id': COMPONENT_ID$2,
|
|
472
|
-
'data-garden-version': '8.
|
|
352
|
+
'data-garden-version': '8.58.0'
|
|
473
353
|
}).withConfig({
|
|
474
354
|
displayName: "StyledStandaloneStatus",
|
|
475
355
|
componentId: "sc-1ow4nfj-0"
|
|
476
|
-
})(["display:inline-flex;flex-flow:row nowrap;transition:all ", "s ease-in-out;margin:0;box-sizing:content-box;", ";"], TRANSITION_DURATION,
|
|
477
|
-
return reactTheming.retrieveComponentStyles(COMPONENT_ID$2, props);
|
|
478
|
-
});
|
|
356
|
+
})(["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));
|
|
479
357
|
StyledStandaloneStatus.defaultProps = {
|
|
480
358
|
theme: reactTheming.DEFAULT_THEME
|
|
481
359
|
};
|
|
482
360
|
|
|
483
|
-
|
|
361
|
+
const COMPONENT_ID$1 = 'avatars.status-indicator.caption';
|
|
484
362
|
function sizeStyles(props) {
|
|
485
|
-
|
|
363
|
+
const marginRule = `margin-${props.theme.rtl ? 'right' : 'left'}: ${props.theme.space.base * 2}px;`;
|
|
486
364
|
return styled.css(["", " line-height:", ";font-size:", ";"], marginRule, reactTheming.getLineHeight(props.theme.lineHeights.md, props.theme.fontSizes.md), props.theme.fontSizes.md);
|
|
487
365
|
}
|
|
488
|
-
|
|
366
|
+
const StyledStandaloneStatusCaption = styled__default["default"].figcaption.attrs({
|
|
489
367
|
'data-garden-id': COMPONENT_ID$1,
|
|
490
|
-
'data-garden-version': '8.
|
|
368
|
+
'data-garden-version': '8.58.0'
|
|
491
369
|
}).withConfig({
|
|
492
370
|
displayName: "StyledStandaloneStatusCaption",
|
|
493
371
|
componentId: "sc-aalyk1-0"
|
|
494
|
-
})(["", " ", ";"], sizeStyles,
|
|
495
|
-
return reactTheming.retrieveComponentStyles(COMPONENT_ID$1, props);
|
|
496
|
-
});
|
|
372
|
+
})(["", " ", ";"], sizeStyles, props => reactTheming.retrieveComponentStyles(COMPONENT_ID$1, props));
|
|
497
373
|
StyledStandaloneStatusCaption.defaultProps = {
|
|
498
374
|
theme: reactTheming.DEFAULT_THEME
|
|
499
375
|
};
|
|
500
376
|
|
|
501
|
-
|
|
502
|
-
|
|
377
|
+
const COMPONENT_ID = 'avatars.status-indicator.indicator';
|
|
378
|
+
const StyledStandaloneStatusIndicator = styled__default["default"](StyledStatusIndicatorBase).attrs({
|
|
503
379
|
'data-garden-id': COMPONENT_ID,
|
|
504
|
-
'data-garden-version': '8.
|
|
380
|
+
'data-garden-version': '8.58.0'
|
|
505
381
|
}).withConfig({
|
|
506
382
|
displayName: "StyledStandaloneStatusIndicator",
|
|
507
383
|
componentId: "sc-1xt1heq-0"
|
|
508
|
-
})(["position:relative;margin-top:", ";", ";"],
|
|
509
|
-
return "calc((".concat(props.theme.lineHeights.md, " - ").concat(getStatusSize(props, '0'), ") / 2)");
|
|
510
|
-
}, function (props) {
|
|
511
|
-
return reactTheming.retrieveComponentStyles(COMPONENT_ID, props);
|
|
512
|
-
});
|
|
384
|
+
})(["position:relative;margin-top:", ";", ";"], props => `calc((${props.theme.lineHeights.md} - ${getStatusSize(props, '0')}) / 2)`, props => reactTheming.retrieveComponentStyles(COMPONENT_ID, props));
|
|
513
385
|
StyledStandaloneStatusIndicator.defaultProps = {
|
|
514
386
|
type: 'offline',
|
|
515
387
|
theme: reactTheming.DEFAULT_THEME
|
|
516
388
|
};
|
|
517
389
|
|
|
518
|
-
|
|
519
|
-
|
|
520
|
-
|
|
521
|
-
}, props));
|
|
522
|
-
});
|
|
390
|
+
const TextComponent = React.forwardRef((props, ref) => React__default["default"].createElement(StyledText, _extends$4({
|
|
391
|
+
ref: ref
|
|
392
|
+
}, props)));
|
|
523
393
|
TextComponent.displayName = 'Avatar.Text';
|
|
524
|
-
|
|
525
|
-
|
|
526
|
-
|
|
527
|
-
|
|
528
|
-
|
|
529
|
-
|
|
530
|
-
|
|
531
|
-
|
|
532
|
-
|
|
533
|
-
|
|
534
|
-
|
|
535
|
-
|
|
536
|
-
|
|
537
|
-
|
|
538
|
-
|
|
539
|
-
|
|
394
|
+
const Text = TextComponent;
|
|
395
|
+
|
|
396
|
+
const AvatarComponent = React.forwardRef((_ref, ref) => {
|
|
397
|
+
let {
|
|
398
|
+
isSystem,
|
|
399
|
+
size,
|
|
400
|
+
status,
|
|
401
|
+
children,
|
|
402
|
+
badge,
|
|
403
|
+
surfaceColor,
|
|
404
|
+
backgroundColor,
|
|
405
|
+
foregroundColor,
|
|
406
|
+
...props
|
|
407
|
+
} = _ref;
|
|
408
|
+
const computedStatus = badge === undefined ? status : 'active';
|
|
409
|
+
let ClockIcon = SvgClockStroke$1;
|
|
410
|
+
let ArrowLeftIcon = SvgArrowLeftSmStroke$1;
|
|
540
411
|
if (['large', 'medium'].includes(size)) {
|
|
541
412
|
ClockIcon = SvgClockStroke;
|
|
542
413
|
ArrowLeftIcon = SvgArrowLeftSmStroke;
|
|
543
414
|
}
|
|
544
|
-
|
|
545
|
-
|
|
415
|
+
const defaultStatusLabel = React.useMemo(() => {
|
|
416
|
+
let statusMessage = computedStatus;
|
|
546
417
|
if (computedStatus === 'active') {
|
|
547
|
-
|
|
548
|
-
statusMessage =
|
|
418
|
+
const count = typeof badge === 'string' ? parseInt(badge, 10) : badge;
|
|
419
|
+
statusMessage = `active. ${count > 0 ? `${count} notification${count > 1 ? 's' : ''}` : 'no notifications'}`;
|
|
549
420
|
}
|
|
550
421
|
return ['status'].concat(statusMessage || []).join(': ');
|
|
551
422
|
}, [computedStatus, badge]);
|
|
552
|
-
|
|
423
|
+
const statusLabel = reactTheming.useText(AvatarComponent, props, 'statusLabel', defaultStatusLabel);
|
|
553
424
|
return React__default["default"].createElement(StyledAvatar, _extends$4({
|
|
554
425
|
ref: ref,
|
|
555
426
|
isSystem: isSystem,
|
|
@@ -563,8 +434,6 @@ var AvatarComponent = React.forwardRef(function (_ref, ref) {
|
|
|
563
434
|
}, props), React.Children.only(children), computedStatus && React__default["default"].createElement(StyledStatusIndicator, {
|
|
564
435
|
size: size,
|
|
565
436
|
type: computedStatus,
|
|
566
|
-
backgroundColor: backgroundColor,
|
|
567
|
-
foregroundColor: foregroundColor,
|
|
568
437
|
surfaceColor: surfaceColor,
|
|
569
438
|
"aria-label": statusLabel,
|
|
570
439
|
role: "img"
|
|
@@ -590,26 +459,25 @@ AvatarComponent.propTypes = {
|
|
|
590
459
|
AvatarComponent.defaultProps = {
|
|
591
460
|
size: 'medium'
|
|
592
461
|
};
|
|
593
|
-
|
|
462
|
+
const Avatar = AvatarComponent;
|
|
594
463
|
Avatar.Text = Text;
|
|
595
464
|
|
|
596
|
-
|
|
597
|
-
|
|
598
|
-
|
|
599
|
-
|
|
600
|
-
|
|
601
|
-
|
|
602
|
-
|
|
603
|
-
|
|
604
|
-
|
|
465
|
+
const StatusIndicator = React.forwardRef((_ref, ref) => {
|
|
466
|
+
let {
|
|
467
|
+
children,
|
|
468
|
+
type,
|
|
469
|
+
isCompact,
|
|
470
|
+
'aria-label': label,
|
|
471
|
+
...props
|
|
472
|
+
} = _ref;
|
|
473
|
+
let ClockIcon = SvgClockStroke;
|
|
474
|
+
let ArrowLeftIcon = SvgArrowLeftSmStroke;
|
|
605
475
|
if (isCompact) {
|
|
606
476
|
ClockIcon = SvgClockStroke$1;
|
|
607
477
|
ArrowLeftIcon = SvgArrowLeftSmStroke$1;
|
|
608
478
|
}
|
|
609
|
-
|
|
610
|
-
|
|
611
|
-
}, [type]);
|
|
612
|
-
var ariaLabel = reactTheming.useText(StatusIndicatorComponent, {
|
|
479
|
+
const defaultLabel = React.useMemo(() => ['status'].concat(type || []).join(': '), [type]);
|
|
480
|
+
const ariaLabel = reactTheming.useText(StatusIndicator, {
|
|
613
481
|
'aria-label': label
|
|
614
482
|
}, 'aria-label', defaultLabel);
|
|
615
483
|
return React__default["default"].createElement(StyledStandaloneStatus, _extends$4({
|
|
@@ -628,15 +496,14 @@ var StatusIndicatorComponent = React.forwardRef(function (_ref, ref) {
|
|
|
628
496
|
"aria-hidden": "true"
|
|
629
497
|
}) : null), children && React__default["default"].createElement(StyledStandaloneStatusCaption, null, children));
|
|
630
498
|
});
|
|
631
|
-
|
|
632
|
-
|
|
499
|
+
StatusIndicator.displayName = 'StatusIndicator';
|
|
500
|
+
StatusIndicator.propTypes = {
|
|
633
501
|
type: PropTypes__default["default"].oneOf(STATUS),
|
|
634
502
|
isCompact: PropTypes__default["default"].bool
|
|
635
503
|
};
|
|
636
|
-
|
|
504
|
+
StatusIndicator.defaultProps = {
|
|
637
505
|
type: 'offline'
|
|
638
506
|
};
|
|
639
|
-
var StatusIndicator = StatusIndicatorComponent;
|
|
640
507
|
|
|
641
508
|
exports.Avatar = Avatar;
|
|
642
509
|
exports.StatusIndicator = StatusIndicator;
|