1 | "use strict";
|
2 |
|
3 | Object.defineProperty(exports, "__esModule", {
|
4 | value: true
|
5 | });
|
6 | exports.Root = exports.Initials = exports.Avatar = void 0;
|
7 |
|
8 | var _index = require("../styles/index.js");
|
9 |
|
10 | function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); keys.push.apply(keys, symbols); } return keys; }
|
11 |
|
12 | function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys(Object(source), true).forEach(function (key) { _defineProperty(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; }
|
13 |
|
14 | function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
15 |
|
16 | function getSize(props) {
|
17 | var $size = props.$size,
|
18 | $theme = props.$theme;
|
19 | var defaultSize = $theme.sizing.scale1000;
|
20 | var size = $size || defaultSize;
|
21 | return $theme.sizing[size] || size;
|
22 | }
|
23 |
|
24 | var Avatar = (0, _index.styled)('img', function (props) {
|
25 | var themedSize = getSize(props);
|
26 | return {
|
27 | borderTopLeftRadius: '50%',
|
28 | borderTopRightRadius: '50%',
|
29 | borderBottomRightRadius: '50%',
|
30 | borderBottomLeftRadius: '50%',
|
31 | boxSizing: 'border-box',
|
32 | display: 'block',
|
33 | height: themedSize,
|
34 | width: themedSize,
|
35 | objectFit: 'cover'
|
36 | };
|
37 | });
|
38 | exports.Avatar = Avatar;
|
39 | Avatar.displayName = "Avatar";
|
40 | var Initials = (0, _index.styled)('div', function (props) {
|
41 | return _objectSpread({}, props.$theme.typography.font300, {
|
42 | color: props.$theme.colors.mono100,
|
43 | alignItems: 'center',
|
44 | display: 'flex',
|
45 | justifyContent: 'center',
|
46 | height: '100%'
|
47 | });
|
48 | });
|
49 | exports.Initials = Initials;
|
50 | Initials.displayName = "Initials";
|
51 | var Root = (0, _index.styled)('div', function (props) {
|
52 | var $didImageFailToLoad = props.$didImageFailToLoad;
|
53 | var themedSize = getSize(props);
|
54 | return {
|
55 | backgroundColor: $didImageFailToLoad ? props.$theme.colors.primary : null,
|
56 | borderTopLeftRadius: '50%',
|
57 | borderTopRightRadius: '50%',
|
58 | borderBottomRightRadius: '50%',
|
59 | borderBottomLeftRadius: '50%',
|
60 | boxSizing: 'border-box',
|
61 | display: 'inline-block',
|
62 |
|
63 |
|
64 | height: $didImageFailToLoad ? themedSize : null,
|
65 | width: $didImageFailToLoad ? themedSize : null
|
66 | };
|
67 | });
|
68 | exports.Root = Root;
|
69 | Root.displayName = "Root"; |
\ | No newline at end of file |