@synerise/ds-avatar 0.14.2 → 0.14.3

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/CHANGELOG.md CHANGED
@@ -3,6 +3,14 @@
3
3
  All notable changes to this project will be documented in this file.
4
4
  See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
5
5
 
6
+ ## [0.14.3](https://github.com/synerise/synerise-design/compare/@synerise/ds-avatar@0.14.2...@synerise/ds-avatar@0.14.3) (2021-11-22)
7
+
8
+ **Note:** Version bump only for package @synerise/ds-avatar
9
+
10
+
11
+
12
+
13
+
6
14
  ## [0.14.2](https://github.com/synerise/synerise-design/compare/@synerise/ds-avatar@0.14.1...@synerise/ds-avatar@0.14.2) (2021-11-16)
7
15
 
8
16
  **Note:** Version bump only for package @synerise/ds-avatar
package/dist/Avatar.js CHANGED
@@ -3,14 +3,12 @@ var _excluded = ["backgroundColor", "backgroundColorHue", "children", "disabled"
3
3
 
4
4
  function _extends() { _extends = Object.assign || 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); }
5
5
 
6
- 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; }
6
+ 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; }
7
7
 
8
8
  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; }
9
9
 
10
10
  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; }
11
11
 
12
- function _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; }
13
-
14
12
  function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }
15
13
 
16
14
  import * as React from 'react';
@@ -45,28 +43,28 @@ var Avatar = function Avatar(_ref) {
45
43
  tooltip = _ref$tooltip === void 0 ? {} : _ref$tooltip,
46
44
  _ref$size = _ref.size,
47
45
  size = _ref$size === void 0 ? DEFAULT_SIZE : _ref$size,
48
- antdProps = _objectWithoutProperties(_ref, _excluded);
46
+ antdProps = _objectWithoutPropertiesLoose(_ref, _excluded);
49
47
 
50
48
  var sizes = _objectSpread({}, ICON_SIZES);
51
49
 
52
50
  var iconElement = iconComponent; // Enforce icon to be scaled
53
51
 
54
- if (isIconComponent((_iconElement = iconElement) === null || _iconElement === void 0 ? void 0 : _iconElement.type) && iconScale) {
52
+ if (isIconComponent((_iconElement = iconElement) == null ? void 0 : _iconElement.type) && iconScale) {
55
53
  var _iconElement$props$co, _iconElement$props$co2, _iconElement$props$co3;
56
54
 
57
- if ((_iconElement$props$co = iconElement.props.component) !== null && _iconElement$props$co !== void 0 && (_iconElement$props$co2 = _iconElement$props$co.type) !== null && _iconElement$props$co2 !== void 0 && (_iconElement$props$co3 = _iconElement$props$co2.name) !== null && _iconElement$props$co3 !== void 0 && _iconElement$props$co3.match(/S$/)) {
55
+ if ((_iconElement$props$co = iconElement.props.component) != null && (_iconElement$props$co2 = _iconElement$props$co.type) != null && (_iconElement$props$co3 = _iconElement$props$co2.name) != null && _iconElement$props$co3.match(/S$/)) {
58
56
  sizes.small = 24;
59
57
  }
60
58
 
61
59
  var iconSize = sizes[size] || sizes[DEFAULT_SIZE];
62
- iconElement = /*#__PURE__*/React.cloneElement(iconElement, {
60
+ iconElement = React.cloneElement(iconElement, {
63
61
  size: iconSize
64
62
  });
65
63
  }
66
64
 
67
65
  var _getTooltipProps = getTooltipProps(tooltip),
68
66
  type = _getTooltipProps.type,
69
- tooltipProps = _objectWithoutProperties(_getTooltipProps, _excluded2);
67
+ tooltipProps = _objectWithoutPropertiesLoose(_getTooltipProps, _excluded2);
70
68
 
71
69
  var hasTooltip = Object.keys(tooltipProps).length && !!Object.values(tooltipProps).reduce(function (prev, next) {
72
70
  return next || prev;
@@ -43,7 +43,7 @@ describe('Avatar', function () {
43
43
  var img = container.querySelector('img'); // ASSERT
44
44
 
45
45
  expect(container).toContainElement(img);
46
- expect(img).toHaveAttribute('src', expect.stringContaining("".concat(IMG_SRC)));
46
+ expect(img).toHaveAttribute('src', expect.stringContaining("" + IMG_SRC));
47
47
  });
48
48
  it('should render with badge dot', function () {
49
49
  // ARRANGE
@@ -2,8 +2,6 @@ var _excluded = ["backgroundColorHue", "backgroundColor", "onClick", "hasStatus"
2
2
 
3
3
  function _extends() { _extends = Object.assign || 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); }
4
4
 
5
- function _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; }
6
-
7
5
  function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }
8
6
 
9
7
  import * as React from 'react';
@@ -16,7 +14,7 @@ export var TooltipGroup = styled.div.withConfig({
16
14
  })(["margin:13px 8px;font-size:11px;line-height:1.45;text-align:center;p{margin:0;font-weight:normal;&:first-child{font-weight:500;}}"]);
17
15
 
18
16
  var applyBgColors = function applyBgColors(props) {
19
- return css(["background:", ";"], props.theme.palette["".concat(props.backgroundColor, "-").concat(props.backgroundColorHue ? props.backgroundColorHue : '400')]);
17
+ return css(["background:", ";"], props.theme.palette[props.backgroundColor + "-" + (props.backgroundColorHue ? props.backgroundColorHue : '400')]);
20
18
  };
21
19
 
22
20
  var applyDisabledStyles = function applyDisabledStyles(props) {
@@ -41,11 +39,11 @@ var FONT_SIZE = {
41
39
  };
42
40
 
43
41
  var applyBadgePosition = function applyBadgePosition(props) {
44
- return css(["top:", ";right:", ";"], BADGE_POSITION["".concat(props.shape).concat(props.size)] || '0', BADGE_POSITION["".concat(props.shape).concat(props.size)] || '0');
42
+ return css(["top:", ";right:", ";"], BADGE_POSITION["" + props.shape + props.size] || '0', BADGE_POSITION["" + props.shape + props.size] || '0');
45
43
  };
46
44
 
47
45
  var applyFontSize = function applyFontSize(props) {
48
- return css(["", ";"], macro[FONT_SIZE["".concat(props.size)]]);
46
+ return css(["", ";"], macro[FONT_SIZE["" + props.size]]);
49
47
  }; // eslint-disable-next-line react/jsx-props-no-spreading
50
48
 
51
49
 
@@ -55,7 +53,7 @@ export default styled(function (_ref) {
55
53
  onClick = _ref.onClick,
56
54
  hasStatus = _ref.hasStatus,
57
55
  hasTooltip = _ref.hasTooltip,
58
- rest = _objectWithoutProperties(_ref, _excluded);
56
+ rest = _objectWithoutPropertiesLoose(_ref, _excluded);
59
57
 
60
58
  return /*#__PURE__*/React.createElement(Avatar, _extends({
61
59
  onClick: onClick
@@ -2,20 +2,6 @@ var _excluded = ["backgroundColor", "badgeStatus", "iconComponent", "color", "ob
2
2
 
3
3
  function _extends() { _extends = Object.assign || 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); }
4
4
 
5
- function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
6
-
7
- function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
8
-
9
- function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
10
-
11
- function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) { arr2[i] = arr[i]; } return arr2; }
12
-
13
- function _iterableToArrayLimit(arr, i) { var _i = arr == null ? null : typeof Symbol !== "undefined" && arr[Symbol.iterator] || arr["@@iterator"]; if (_i == null) return; var _arr = []; var _n = true; var _d = false; var _s, _e; try { for (_i = _i.call(arr); !(_n = (_s = _i.next()).done); _n = true) { _arr.push(_s.value); if (i && _arr.length === i) break; } } catch (err) { _d = true; _e = err; } finally { try { if (!_n && _i["return"] != null) _i["return"](); } finally { if (_d) throw _e; } } return _arr; }
14
-
15
- function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
16
-
17
- function _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; }
18
-
19
5
  function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }
20
6
 
21
7
  import * as React from 'react';
@@ -43,7 +29,7 @@ var ObjectAvatar = function ObjectAvatar(_ref) {
43
29
  children = _ref.children,
44
30
  disabled = _ref.disabled,
45
31
  style = _ref.style,
46
- restProps = _objectWithoutProperties(_ref, _excluded);
32
+ restProps = _objectWithoutPropertiesLoose(_ref, _excluded);
47
33
 
48
34
  var _ref2 = object || {},
49
35
  objectName = _ref2.name,
@@ -62,11 +48,10 @@ var ObjectAvatar = function ObjectAvatar(_ref) {
62
48
  var avatarText = getObjectName(objectName, text);
63
49
 
64
50
  var _getColorByText = getColorByText(avatarText, backgroundColor),
65
- _getColorByText2 = _slicedToArray(_getColorByText, 2),
66
- avatarBackgroundColor = _getColorByText2[0],
67
- avatarBackgroundHue = _getColorByText2[1];
51
+ avatarBackgroundColor = _getColorByText[0],
52
+ avatarBackgroundHue = _getColorByText[1];
68
53
 
69
- var iconColor = theme.palette["".concat(color || DEFAULT_COLOR, "-").concat(DEFAULT_COLOR_HUE)];
54
+ var iconColor = theme.palette[(color || DEFAULT_COLOR) + "-" + DEFAULT_COLOR_HUE];
70
55
  var avatarTooltip = tooltip === undefined && (defaultTooltip.title || defaultTooltip.description) ? defaultTooltip : tooltip;
71
56
  var iconElement = addIconColor(iconComponent, iconColor);
72
57
  var icon = !avatarText ? iconElement || /*#__PURE__*/React.createElement(Icon, {
@@ -2,20 +2,6 @@ var _excluded = ["backgroundColor", "size", "text", "tooltip", "badgeStatus", "u
2
2
 
3
3
  function _extends() { _extends = Object.assign || 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); }
4
4
 
5
- function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
6
-
7
- function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
8
-
9
- function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
10
-
11
- function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) { arr2[i] = arr[i]; } return arr2; }
12
-
13
- function _iterableToArrayLimit(arr, i) { var _i = arr == null ? null : typeof Symbol !== "undefined" && arr[Symbol.iterator] || arr["@@iterator"]; if (_i == null) return; var _arr = []; var _n = true; var _d = false; var _s, _e; try { for (_i = _i.call(arr); !(_n = (_s = _i.next()).done); _n = true) { _arr.push(_s.value); if (i && _arr.length === i) break; } } catch (err) { _d = true; _e = err; } finally { try { if (!_n && _i["return"] != null) _i["return"](); } finally { if (_d) throw _e; } } return _arr; }
14
-
15
- function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
16
-
17
- function _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; }
18
-
19
5
  function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }
20
6
 
21
7
  import * as React from 'react';
@@ -40,7 +26,7 @@ var UserAvatar = function UserAvatar(_ref) {
40
26
  children = _ref.children,
41
27
  disabled = _ref.disabled,
42
28
  style = _ref.style,
43
- restProps = _objectWithoutProperties(_ref, _excluded);
29
+ restProps = _objectWithoutPropertiesLoose(_ref, _excluded);
44
30
 
45
31
  var _ref2 = user || {},
46
32
  _ref2$firstName = _ref2.firstName,
@@ -53,11 +39,11 @@ var UserAvatar = function UserAvatar(_ref) {
53
39
 
54
40
  var avatarText = getUserText(user, src, text);
55
41
  var defaultTooltip = {
56
- title: "".concat(firstName || '', " ").concat(lastName || '').trim(),
42
+ title: ((firstName || '') + " " + (lastName || '')).trim(),
57
43
  description: email || ''
58
44
  };
59
45
  var avatarTooltip = (tooltip === undefined || tooltip === true) && (defaultTooltip.title || defaultTooltip.description) ? defaultTooltip : tooltip;
60
- var iconColor = theme.palette["".concat(DEFAULT_COLOR, "-").concat(DEFAULT_COLOR_HUE)];
46
+ var iconColor = theme.palette[DEFAULT_COLOR + "-" + DEFAULT_COLOR_HUE];
61
47
  var iconElement = addIconColor(iconComponent, iconColor);
62
48
  var icon = !avatarText ? iconElement || /*#__PURE__*/React.createElement(Icon, {
63
49
  component: size === 'small' ? /*#__PURE__*/React.createElement(UserS, null) : /*#__PURE__*/React.createElement(UserM, null),
@@ -65,9 +51,8 @@ var UserAvatar = function UserAvatar(_ref) {
65
51
  }) : null;
66
52
 
67
53
  var _getColorByText = getColorByText(avatarText, backgroundColor),
68
- _getColorByText2 = _slicedToArray(_getColorByText, 2),
69
- avatarBackgroundColor = _getColorByText2[0],
70
- avatarBackgroundHue = _getColorByText2[1];
54
+ avatarBackgroundColor = _getColorByText[0],
55
+ avatarBackgroundHue = _getColorByText[1];
71
56
 
72
57
  var avatarRender = /*#__PURE__*/React.createElement(Avatar, _extends({
73
58
  iconComponent: icon,
package/dist/utils.js CHANGED
@@ -1,11 +1,9 @@
1
- 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; }
1
+ 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; }
2
2
 
3
3
  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; }
4
4
 
5
5
  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; }
6
6
 
7
- function _typeof(obj) { "@babel/helpers - typeof"; if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); }
8
-
9
7
  import * as React from 'react';
10
8
  import Icon from '@synerise/ds-icon';
11
9
  import selectColorByLetter from '@synerise/ds-utils/dist/selectColorByLetter/selectColorByLetter';
@@ -14,9 +12,15 @@ function getFirstLetter(from) {
14
12
  return (from || '').substr(0, 1).toUpperCase();
15
13
  }
16
14
 
17
- export function getUserText(user) {
18
- var src = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : '';
19
- var text = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : '';
15
+ export function getUserText(user, src, text) {
16
+ if (src === void 0) {
17
+ src = '';
18
+ }
19
+
20
+ if (text === void 0) {
21
+ text = '';
22
+ }
23
+
20
24
  var _user$firstName = user.firstName,
21
25
  firstName = _user$firstName === void 0 ? '' : _user$firstName,
22
26
  _user$lastName = user.lastName,
@@ -27,16 +31,22 @@ export function getUserText(user) {
27
31
  avatar = _user$avatar === void 0 ? '' : _user$avatar;
28
32
  if (src || avatar) return null;
29
33
  if (text) return text;
30
- if (firstName || lastName) return "".concat(getFirstLetter(firstName)).concat(getFirstLetter(lastName));
34
+ if (firstName || lastName) return "" + getFirstLetter(firstName) + getFirstLetter(lastName);
31
35
  if (email) return getFirstLetter(email);
32
36
  return null;
33
37
  }
34
38
  export function isIconComponent(component) {
35
39
  return component ? component.name === Icon.name : false;
36
40
  }
37
- export function getObjectName() {
38
- var name = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : '';
39
- var text = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : '';
41
+ export function getObjectName(name, text) {
42
+ if (name === void 0) {
43
+ name = '';
44
+ }
45
+
46
+ if (text === void 0) {
47
+ text = '';
48
+ }
49
+
40
50
  if (text) return text.toUpperCase();
41
51
  if (name) return name.substr(0, 1).toUpperCase();
42
52
  return null;
@@ -46,8 +56,8 @@ export function addIconColor(iconComponent, color) {
46
56
 
47
57
  var iconElement = iconComponent;
48
58
 
49
- if (isIconComponent((_iconElement = iconElement) === null || _iconElement === void 0 ? void 0 : _iconElement.type) && !((_iconElement2 = iconElement) !== null && _iconElement2 !== void 0 && (_iconElement2$props = _iconElement2.props) !== null && _iconElement2$props !== void 0 && _iconElement2$props.color)) {
50
- iconElement = /*#__PURE__*/React.cloneElement(iconElement, {
59
+ if (isIconComponent((_iconElement = iconElement) == null ? void 0 : _iconElement.type) && !((_iconElement2 = iconElement) != null && (_iconElement2$props = _iconElement2.props) != null && _iconElement2$props.color)) {
60
+ iconElement = React.cloneElement(iconElement, {
51
61
  color: color
52
62
  });
53
63
  }
@@ -57,23 +67,23 @@ export function addIconColor(iconComponent, color) {
57
67
  export function getColorByText(text, backgroundColor) {
58
68
  var _ref;
59
69
 
60
- var autoColor = ((_ref = typeof text === 'string' ? selectColorByLetter(text.slice(0, 1), true) : {}) === null || _ref === void 0 ? void 0 : _ref.color) || 'grey';
70
+ var autoColor = ((_ref = typeof text === 'string' ? selectColorByLetter(text.slice(0, 1), true) : {}) == null ? void 0 : _ref.color) || 'grey';
61
71
  var color = text && backgroundColor && backgroundColor !== 'auto' ? backgroundColor : autoColor;
62
72
  var hue = text ? '500' : '100';
63
73
  return [color, hue];
64
74
  }
65
75
  export function getTooltipProps(tooltip) {
66
- var tooltipProps = _typeof(tooltip) === 'object' ? _objectSpread(_objectSpread({}, tooltip), {}, {
76
+ var tooltipProps = typeof tooltip === 'object' ? _objectSpread({}, tooltip, {
67
77
  title: tooltip.title || tooltip.name,
68
78
  description: tooltip.description || tooltip.email
69
79
  }) : {};
70
80
  var tooltipType = ['title', 'description', 'status'].reduce(function (prev, next) {
71
81
  return tooltipProps[next] ? prev + 1 : prev;
72
82
  }, 0) === 1 ? 'default' : 'avatar';
73
- var finalTooltipProps = tooltipType === 'default' ? _objectSpread(_objectSpread({}, tooltipProps), {}, {
83
+ var finalTooltipProps = tooltipType === 'default' ? _objectSpread({}, tooltipProps, {
74
84
  title: tooltipProps.title || tooltipProps.description || tooltipProps.status,
75
85
  type: 'default'
76
- }) : _objectSpread(_objectSpread({}, tooltipProps), {}, {
86
+ }) : _objectSpread({}, tooltipProps, {
77
87
  type: 'avatar'
78
88
  });
79
89
  return finalTooltipProps;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@synerise/ds-avatar",
3
- "version": "0.14.2",
3
+ "version": "0.14.3",
4
4
  "description": "Avatar UI Component for the Synerise Design System",
5
5
  "license": "ISC",
6
6
  "repository": "synerise/synerise-design",
@@ -32,10 +32,10 @@
32
32
  ],
33
33
  "types": "dist/index.d.ts",
34
34
  "dependencies": {
35
- "@synerise/ds-badge": "^0.5.2",
36
- "@synerise/ds-icon": "^0.46.1",
37
- "@synerise/ds-status": "^0.5.2",
38
- "@synerise/ds-tooltip": "^0.11.1"
35
+ "@synerise/ds-badge": "^0.5.3",
36
+ "@synerise/ds-icon": "^0.46.2",
37
+ "@synerise/ds-status": "^0.5.3",
38
+ "@synerise/ds-tooltip": "^0.11.2"
39
39
  },
40
40
  "peerDependencies": {
41
41
  "@synerise/ds-core": "*",
@@ -45,5 +45,5 @@
45
45
  "devDependencies": {
46
46
  "@synerise/ds-utils": "^0.19.0"
47
47
  },
48
- "gitHead": "8e667a88a48d774c550ff4766de71c4aab01f5a9"
48
+ "gitHead": "2468359677783819939fb9f1ef5acc36667ecd1a"
49
49
  }