@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
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 (
|
|
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 (
|
|
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 (
|
|
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 (
|
|
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
|
|
125
|
+
'data-garden-version': '9.0.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
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
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
|
|
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
|
|
157
|
-
switch (props
|
|
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:", ";
|
|
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 =
|
|
183
|
-
let
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
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,
|
|
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
|
|
245
|
+
'data-garden-version': '9.0.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
|
|
258
|
+
const isVisible = !includes([xxs, xs], props.$size);
|
|
207
259
|
const borderWidth = getStatusBorderOffset(props);
|
|
208
260
|
let padding = '0';
|
|
209
|
-
if (props
|
|
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
|
|
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 =
|
|
217
|
-
|
|
268
|
+
const colorStyles$1 = _ref => {
|
|
269
|
+
let {
|
|
218
270
|
theme,
|
|
219
|
-
type,
|
|
220
|
-
size,
|
|
221
|
-
borderColor,
|
|
222
|
-
surfaceColor
|
|
223
|
-
} =
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
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
|
|
294
|
+
'data-garden-version': '9.0.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
|
|
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
|
|
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 =
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
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
|
|
365
|
+
if (props.$size === 'extraextrasmall') {
|
|
274
366
|
boxShadow = `0 0 0 ${polished.math(`${props.theme.shadowWidths.sm} - 1`)}`;
|
|
275
|
-
borderRadius = props
|
|
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
|
|
371
|
+
} else if (props.$size === 'extrasmall') {
|
|
280
372
|
boxShadow = `inset 0 0 0 ${props.theme.shadowWidths.sm}`;
|
|
281
|
-
borderRadius = props
|
|
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
|
|
377
|
+
} else if (props.$size === 'small') {
|
|
286
378
|
boxShadow = `inset 0 0 0 ${props.theme.shadowWidths.sm}`;
|
|
287
|
-
borderRadius = props
|
|
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
|
|
383
|
+
} else if (props.$size === 'large') {
|
|
292
384
|
boxShadow = `inset 0 0 0 ${props.theme.shadowWidths.sm}`;
|
|
293
|
-
borderRadius = props
|
|
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
|
|
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
|
|
400
|
+
'data-garden-version': '9.0.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
|
|
413
|
+
'data-garden-version': '9.0.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
|
|
426
|
+
'data-garden-version': '9.0.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
|
|
435
|
+
'data-garden-version': '9.0.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:
|
|
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
|
|
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(
|
|
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
|
-
/**
|
|
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
|
-
/**
|
|
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
|
-
/**
|
|
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
|
|
3
|
+
"version": "9.0.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.
|
|
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": "
|
|
30
|
-
"react-dom": "
|
|
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-
|
|
35
|
-
"@zendeskgarden/
|
|
34
|
+
"@zendeskgarden/react-dropdowns": "^9.0.0",
|
|
35
|
+
"@zendeskgarden/react-theming": "^9.0.0",
|
|
36
|
+
"@zendeskgarden/svg-icons": "7.2.0"
|
|
36
37
|
},
|
|
37
38
|
"keywords": [
|
|
38
39
|
"components",
|
|
@@ -43,6 +44,5 @@
|
|
|
43
44
|
"publishConfig": {
|
|
44
45
|
"access": "public"
|
|
45
46
|
},
|
|
46
|
-
"zendeskgarden:src": "src/index.ts"
|
|
47
|
-
"gitHead": "771281b562d376a6aee04b0cd71dd888b3ae4a1d"
|
|
47
|
+
"zendeskgarden:src": "src/index.ts"
|
|
48
48
|
}
|