@synerise/ds-avatar 2.0.10 → 2.1.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/CHANGELOG.md CHANGED
@@ -3,6 +3,25 @@
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
+ # [2.1.0](https://github.com/synerise/synerise-design/compare/@synerise/ds-avatar@2.0.11...@synerise/ds-avatar@2.1.0) (2026-10-29)
7
+
8
+
9
+ ### Features
10
+
11
+ * integrate Token Studio design tokens across the design system ([aabb447](https://github.com/synerise/synerise-design/commit/aabb447edfb2d0c85e3de1f07e809ef84083453b))
12
+
13
+
14
+
15
+
16
+
17
+ ## [2.0.11](https://github.com/synerise/synerise-design/compare/@synerise/ds-avatar@2.0.10...@synerise/ds-avatar@2.0.11) (2026-10-28)
18
+
19
+ **Note:** Version bump only for package @synerise/ds-avatar
20
+
21
+
22
+
23
+
24
+
6
25
  ## [2.0.10](https://github.com/synerise/synerise-design/compare/@synerise/ds-avatar@2.0.9...@synerise/ds-avatar@2.0.10) (2026-10-26)
7
26
 
8
27
 
package/CLAUDE.md CHANGED
@@ -78,8 +78,8 @@ High-level avatar for objects/entities (products, campaigns, etc.). Square shape
78
78
  | Prop | Type | Default | Description |
79
79
  |------|------|---------|-------------|
80
80
  | `object` | `ObjectAvatar` | `{}` | `{ name?, description?, status?, avatar? }` |
81
- | `color` | `Color` | `'grey'` | Color for the fallback icon (when no text/image) |
82
- | `backgroundColor` | `'auto' \| Color \| string` | `undefined` | Background color; overrides auto-color from `object.name` |
81
+ | `color` | `Color` | `undefined` | Custom colour (600 shade) for the fallback icon; unset uses `--ds-avatar-icon-icon` |
82
+ | `backgroundColor` | `'auto' \| Color \| string` | `undefined` | Background colour; overrides the auto colour from `object.name`. Icon-only avatars use `--ds-avatar-icon-bg-*` unless this is set (`'auto'` counts as unset) |
83
83
  | `badgeStatus` | `BadgeStatus` | `undefined` | Same as `UserAvatar` |
84
84
  | `iconComponent` | `ReactNode` | `undefined` | Replaces default `MailM` fallback icon |
85
85
  | `tooltip` | `TooltipObject \| boolean` | auto from `object` | `undefined` → auto-builds from `object.name`/`description`/`status`; `false` disables it |
@@ -167,9 +167,9 @@ Tooltip type is auto-determined: if exactly one of `title`, `description`, `stat
167
167
  Styles in `Avatar.styles.tsx`. A DS-native `AvatarBase` renders the `ant-avatar` root + `ant-avatar-string`/`<img>` child (with `ds-avatar-*` class hooks added alongside the `ant-*` ones during the antd-removal interim); the `StyledAvatar` styled-component applies all visual styling via props and styled sub-component references (`${AvatarString}`) — no `.ant-*` class selectors, except the cross-component `& ~ .ant-badge-dot` sibling (the dot is owned by ds-badge). Key styles:
168
168
 
169
169
  - Dimensions per size set directly in CSS: `small` 24, `medium` 40, `large` 84, `extraLarge` 120 px
170
- - Background applied via `theme.palette[${backgroundColor}-${backgroundColorHue}]` — requires both to be valid token fragments
170
+ - Background resolved through ds-utils `resolveCustomColor(backgroundColor, 'transparent', { defaultShade: backgroundColorHue })` to a flipping semantic `var(--ds-color-custom-<family>-<shade>)` ref, so it adapts to dark mode. The legacy palette hue `'050'` (in `ColorHue` and in `'grey-050'`) maps to the `50` token. A hex or `var()` `backgroundColor` passed to the base `Avatar` is used literally (`passthroughResolved`); `UserAvatar`/`ObjectAvatar` support only hex this way, because `getColorByText` splits any value containing `-` into family/hue, so a `var(--…)` value is mangled to `'var('` and the background declaration is invalid. `'auto'` or an unknown family falls back to `transparent`. An avatar that renders an icon with no `backgroundColor` (or `'auto'`) uses `--ds-avatar-icon-bg-default` (no hover change) instead, and its icon inherits `--ds-avatar-icon-icon` (set without `!important`) in place of the white `--ds-avatar-text-text`, so a container can recolour it (ds-list-item sets `.ds-avatar.ds-avatar { color: inherit }` in its prefix). ObjectAvatar gives the icon an explicit colour only when `color` or `backgroundColor` is set
171
171
  - Badge dot (`ds-badge-dot`) is hidden by default; shown when `hasStatus=true` with size/shape-specific positioning from `BADGE_POSITION` map
172
- - Hover/active darken overlay via `::before` pseudo-element — only applied when `onClick` or `hasTooltip` is truthy
172
+ - Hover/active darken overlay via `::before` pseudo-element (`--ds-avatar-overlay-opacity-hover` / `-pressed`) — only applied when `onClick` or `hasTooltip` is truthy
173
173
  - Font sizes per size via `MACRO_MAPPING` (xsAvatar, small, xlAvatar macros from ds-typography)
174
174
 
175
175
  ## Key dependencies
@@ -183,7 +183,7 @@ Styles in `Avatar.styles.tsx`. A DS-native `AvatarBase` renders the `ant-avatar`
183
183
  ## Implementation notes
184
184
 
185
185
  - `src=""` (empty string) is explicitly converted to `undefined` to prevent showing a broken image.
186
- - `backgroundColor` is a string passed directly into `theme.palette[…]` key lookup — invalid color+hue combos silently produce `undefined` background.
186
+ - `backgroundColor` is resolved with ds-utils `resolveCustomColor` (default hue `500` with text, `100` when empty; `'050'` → the `50` token; with no text a plain family or hex `backgroundColor` is used, not ignored); a hex value is used literally (a `var()` value only on the base `Avatar` — see Styling), and an unknown family or hue falls back to a `transparent` background.
187
187
  - The 100 default SVG components in `defaultAvatars/` are **auto-generated** by `build:svgr` — do not edit them manually; regenerate via `pnpm run build:svgr`.
188
188
  - `getDefaultAvatarIndex` uses a simple djb2-style hash on the string form of `avatarId` — the same `avatarId` always maps to the same avatar across all environments.
189
189
  - `getColorByText` supports a `'color-hue'` dash-separated string shorthand for `backgroundColor` (e.g. `'grey-800'`) — this bypasses the separate `backgroundColorHue` prop entirely.
package/dist/Avatar.js CHANGED
@@ -41,7 +41,7 @@ const Avatar = ({
41
41
  ...tooltipProps
42
42
  } = getTooltipProps(tooltip);
43
43
  const hasTooltip = Object.keys(tooltipProps).length && !!Object.values(tooltipProps).reduce((prev, next) => next || prev);
44
- return /* @__PURE__ */ jsx(Tooltip, { type, ...tooltipProps, children: /* @__PURE__ */ jsx(StyledAvatar, { className: "ds-avatar", hasStatus, hasTooltip: !!hasTooltip, backgroundColor, backgroundColorHue, disabled, size, src: src !== "" ? src : void 0, ...restProps, children: iconElement || children }) });
44
+ return /* @__PURE__ */ jsx(Tooltip, { type, ...tooltipProps, children: /* @__PURE__ */ jsx(StyledAvatar, { className: "ds-avatar", hasStatus, hasTooltip: !!hasTooltip, backgroundColor, backgroundColorHue, $iconTokens: !!iconElement && (!backgroundColor || backgroundColor === "auto"), disabled, size, src: src !== "" ? src : void 0, ...restProps, children: iconElement || children }) });
45
45
  };
46
46
  export {
47
47
  DEFAULT_SIZE,
@@ -2,6 +2,7 @@ import { default as React } from 'react';
2
2
  export declare const TooltipGroup: import('styled-components').StyledComponent<"div", any, {}, never>;
3
3
  type ExtraAvatarProps = {
4
4
  hasTooltip?: boolean;
5
+ $iconTokens?: boolean;
5
6
  };
6
7
  /**
7
8
  * The text/icon container. Its size-dependent styling lives on the root via the
@@ -2,12 +2,27 @@ import { jsx } from "react/jsx-runtime";
2
2
  import { forwardRef } from "react";
3
3
  import styled, { css } from "styled-components";
4
4
  import { macro } from "@synerise/ds-typography";
5
+ import { resolveCustomColor } from "@synerise/ds-utils";
5
6
  const TooltipGroup = /* @__PURE__ */ styled.div.withConfig({
6
7
  displayName: "Avatarstyles__TooltipGroup",
7
8
  componentId: "sc-xcn5o4-0"
8
9
  })(["margin:13px 8px;font-size:11px;line-height:1.45;text-align:center;p{margin:0;font-weight:normal;&:first-child{font-weight:500;}}"]);
9
- const applyBgColors = (props) => css(["background:", ";"], props.theme.palette[`${props.backgroundColor}-${props.backgroundColorHue ? props.backgroundColorHue : "400"}`]);
10
- const applyDisabledStyles = (props) => props.disabled && css(["opacity:0.4;pointer-events:none;"]);
10
+ const applyBgColors = (props) => {
11
+ const {
12
+ backgroundColor,
13
+ backgroundColorHue,
14
+ $iconTokens
15
+ } = props;
16
+ if ($iconTokens) {
17
+ return css(["background:var(--ds-avatar-icon-bg-default);"]);
18
+ }
19
+ const bg = backgroundColor && backgroundColor !== "auto" ? resolveCustomColor(backgroundColor, "transparent", {
20
+ defaultShade: backgroundColorHue || "400",
21
+ passthroughResolved: true
22
+ }) : "transparent";
23
+ return css(["background:", ";"], bg);
24
+ };
25
+ const applyDisabledStyles = (props) => props.disabled && css(["opacity:var(--ds-avatar-disabled-opacity);pointer-events:none;"]);
11
26
  const BADGE_POSITION = {
12
27
  circlesmall: "2px",
13
28
  circlemedium: "5px",
@@ -68,7 +83,7 @@ const AvatarBase = forwardRef(({
68
83
  const StyledAvatar = /* @__PURE__ */ styled(AvatarBase).withConfig({
69
84
  displayName: "Avatarstyles__StyledAvatar",
70
85
  componentId: "sc-xcn5o4-3"
71
- })(["&&{position:relative;display:inline-flex;align-items:center;justify-content:center;box-sizing:border-box;overflow:hidden;width:24px;height:24px;min-width:24px;vertical-align:middle;border-radius:50%;color:", ";user-select:none;transition:background 0.3s ease;", ";", ";", ";", "{position:relative;left:0;width:100%;height:100%;font-size:11px;color:", ";user-select:none;pointer-events:none;", ";", ";& > div{max-width:100%;max-height:100%;svg{width:100%;height:100%;}}}&::before{content:'';position:absolute;top:0;left:0;width:100%;height:100%;background-color:#000;opacity:0;border-radius:inherit;}", ";", ";& ~ .ds-badge-dot{display:none;}", ";", ";", ";", ";}"], (props) => props.theme.palette.white, (props) => applyBgColors(props), (props) => applyDisabledStyles(props), (props) => props.shape === "square" && css(["border-radius:8px;"]), AvatarString, (props) => props.theme.palette.white, (props) => applyFontSize(props), macro.flexCentered, (props) => (props.onClick || props.hasTooltip) && css(["&:hover::before{opacity:0.05;}"]), (props) => props.onClick && css(["cursor:pointer;&:active::before{opacity:0.1;}"]), (props) => props.hasStatus && css(["& ~ .ds-badge-dot{display:flex;border:2px solid ", ";box-sizing:border-box;width:10px;height:10px;box-shadow:none;", ";}"], props.theme.palette.white, applyBadgePosition(props)), (props) => props.size === "medium" && css(["width:40px;min-width:40px;height:40px;", "{line-height:40px;}"], AvatarString), (props) => props.size === "large" && css(["width:84px;min-width:84px;height:84px;", "{line-height:84px;font-size:18px;}"], AvatarString), (props) => props.size === "extraLarge" && css(["width:120px;min-width:120px;height:120px;font-size:22px;", "{line-height:120px;", ";}"], AvatarString, macro.xlAvatar));
86
+ })(["&&{position:relative;display:inline-flex;align-items:center;justify-content:center;box-sizing:border-box;overflow:hidden;width:24px;height:24px;min-width:24px;vertical-align:middle;border-radius:50%;", " user-select:none;transition:background 0.3s ease;", ";", ";", ";", "{position:relative;left:0;width:100%;height:100%;font-size:11px;", " user-select:none;pointer-events:none;", ";", ";& > div{max-width:100%;max-height:100%;svg{width:100%;height:100%;}}}&::before{content:'';position:absolute;top:0;left:0;width:100%;height:100%;background-color:var(--ds-color-background-overlay-solid);opacity:0;border-radius:inherit;}", ";", ";& ~ .ds-badge-dot{display:none;}", ";", ";", ";", ";}"], (props) => props.$iconTokens ? "color: var(--ds-avatar-icon-icon);" : "color: var(--ds-avatar-text-text) !important;", (props) => applyBgColors(props), (props) => applyDisabledStyles(props), (props) => props.shape === "square" && css(["border-radius:8px;"]), AvatarString, (props) => props.$iconTokens ? "color: inherit;" : "color: var(--ds-avatar-text-text) !important;", (props) => applyFontSize(props), macro.flexCentered, (props) => (props.onClick || props.hasTooltip) && css(["&:hover::before{opacity:var(--ds-avatar-overlay-opacity-hover);}"]), (props) => props.onClick && css(["cursor:pointer;&:active::before{opacity:var(--ds-avatar-overlay-opacity-pressed);}"]), (props) => props.hasStatus && css(["& ~ .ds-badge-dot{display:flex;box-sizing:border-box;width:10px;height:10px;box-shadow:none;", ";}"], applyBadgePosition(props)), (props) => props.size === "medium" && css(["width:40px;min-width:40px;height:40px;", "{line-height:40px;}"], AvatarString), (props) => props.size === "large" && css(["width:84px;min-width:84px;height:84px;", "{line-height:84px;font-size:18px;}"], AvatarString), (props) => props.size === "extraLarge" && css(["width:120px;min-width:120px;height:120px;font-size:22px;", "{line-height:120px;", ";}"], AvatarString, macro.xlAvatar));
72
87
  export {
73
88
  AvatarImg,
74
89
  AvatarString,
@@ -1,6 +1,5 @@
1
1
  import { default as React } from 'react';
2
2
  import { ObjectAvatarProps } from '../Avatar.types';
3
3
  export declare const DEFAULT_COLOR_HUE = "600";
4
- export declare const DEFAULT_COLOR = "grey";
5
4
  declare const ObjectAvatar: ({ backgroundColor, badgeStatus, iconComponent, color, object, size, src, tooltip, text, children, disabled, style, ...restProps }: ObjectAvatarProps) => React.JSX.Element;
6
5
  export default ObjectAvatar;
@@ -1,17 +1,16 @@
1
1
  import { jsx } from "react/jsx-runtime";
2
2
  import Badge from "@synerise/ds-badge";
3
- import { theme } from "@synerise/ds-core";
4
3
  import Icon, { MailM } from "@synerise/ds-icon";
5
4
  import Status from "@synerise/ds-status";
5
+ import { customColors } from "@synerise/ds-tokens/names";
6
6
  import Avatar from "../Avatar.js";
7
7
  import { getObjectName, getColorByText, addIconColor } from "../utils.js";
8
8
  const DEFAULT_COLOR_HUE = "600";
9
- const DEFAULT_COLOR = "grey";
10
9
  const ObjectAvatar = ({
11
10
  backgroundColor,
12
11
  badgeStatus,
13
12
  iconComponent,
14
- color = "grey",
13
+ color,
15
14
  object = {},
16
15
  size,
17
16
  src,
@@ -34,16 +33,21 @@ const ObjectAvatar = ({
34
33
  status: objectStatus ? /* @__PURE__ */ jsx(Status, { label: objectStatus, type: "disabled" }) : ""
35
34
  };
36
35
  const avatarText = getObjectName(objectName, text);
36
+ const hasBackgroundColor = !!backgroundColor && backgroundColor !== "auto";
37
37
  const [avatarBackgroundColor, avatarBackgroundHue] = getColorByText(avatarText, backgroundColor);
38
- const iconColor = theme.palette[`${color || DEFAULT_COLOR}-${DEFAULT_COLOR_HUE}`];
38
+ let iconColor;
39
+ if (color) {
40
+ iconColor = customColors[color]?.[DEFAULT_COLOR_HUE];
41
+ } else if (hasBackgroundColor) {
42
+ iconColor = "var(--ds-avatar-icon-icon)";
43
+ }
39
44
  const avatarTooltip = tooltip === void 0 && (defaultTooltip.title || defaultTooltip.description) ? defaultTooltip : tooltip;
40
45
  const iconElement = addIconColor(iconComponent, iconColor);
41
46
  const icon = !avatarText ? iconElement || /* @__PURE__ */ jsx(Icon, { component: /* @__PURE__ */ jsx(MailM, {}), color: iconColor }) : null;
42
- const avatarRender = /* @__PURE__ */ jsx(Avatar, { iconComponent: icon, shape: "square", backgroundColor: avatarBackgroundColor, backgroundColorHue: avatarBackgroundHue, size, hasStatus: disabled === true ? false : !!badgeStatus, src: avatar || src, tooltip: avatarTooltip, disabled, style: badgeStatus ? {} : style, ...restProps, children: children || avatarText });
47
+ const avatarRender = /* @__PURE__ */ jsx(Avatar, { iconComponent: icon, shape: "square", backgroundColor: avatarText || hasBackgroundColor ? avatarBackgroundColor : void 0, backgroundColorHue: avatarBackgroundHue, size, hasStatus: disabled === true ? false : !!badgeStatus, src: avatar || src, tooltip: avatarTooltip, disabled, style: badgeStatus ? {} : style, ...restProps, children: children || avatarText });
43
48
  return badgeStatus ? /* @__PURE__ */ jsx("span", { style, children: /* @__PURE__ */ jsx(Badge, { status: badgeStatus, children: avatarRender }) }) : avatarRender;
44
49
  };
45
50
  export {
46
- DEFAULT_COLOR,
47
51
  DEFAULT_COLOR_HUE,
48
52
  ObjectAvatar as default
49
53
  };
@@ -1,6 +1,4 @@
1
1
  import { default as React } from 'react';
2
2
  import { UserAvatarProps } from '../Avatar.types';
3
- export declare const DEFAULT_COLOR = "grey";
4
- export declare const DEFAULT_COLOR_HUE = "500";
5
3
  declare const UserAvatar: React.FC<UserAvatarProps>;
6
4
  export default UserAvatar;
@@ -1,13 +1,10 @@
1
1
  import { jsx } from "react/jsx-runtime";
2
2
  import Badge from "@synerise/ds-badge";
3
- import { useTheme } from "@synerise/ds-core";
4
3
  import Icon, { UserS, UserM } from "@synerise/ds-icon";
5
4
  import Avatar from "../Avatar.js";
6
5
  import DefaultAvatarIcon from "../DefaultAvatarIcon.js";
7
6
  import { getUserText, addIconColor, getDefaultAvatarIndex, getColorByText } from "../utils.js";
8
7
  import { TOTAL_DEFAULT_AVATARS } from "../defaultAvatars/index.js";
9
- const DEFAULT_COLOR = "grey";
10
- const DEFAULT_COLOR_HUE = "500";
11
8
  const UserAvatar = ({
12
9
  backgroundColor,
13
10
  size,
@@ -22,7 +19,6 @@ const UserAvatar = ({
22
19
  style,
23
20
  ...restProps
24
21
  }) => {
25
- const theme = useTheme();
26
22
  const {
27
23
  firstName = "",
28
24
  lastName = "",
@@ -39,14 +35,14 @@ const UserAvatar = ({
39
35
  description: email || ""
40
36
  };
41
37
  const avatarTooltip = (tooltip === void 0 || tooltip === true) && (defaultTooltip.title || defaultTooltip.description) ? defaultTooltip : tooltip;
42
- const iconColor = theme.palette[`${DEFAULT_COLOR}-${DEFAULT_COLOR_HUE}`];
38
+ const iconColor = "var(--ds-color-icon-base-subtle)";
43
39
  const iconElement = addIconColor(iconComponent, iconColor);
44
40
  let icon = null;
45
41
  if (useDefaultSvg) {
46
42
  const avatarIndex = getDefaultAvatarIndex(avatarId, TOTAL_DEFAULT_AVATARS);
47
43
  icon = /* @__PURE__ */ jsx(DefaultAvatarIcon, { index: avatarIndex });
48
44
  } else if (!avatarText) {
49
- icon = iconElement || /* @__PURE__ */ jsx(Icon, { component: size === "small" ? /* @__PURE__ */ jsx(UserS, {}) : /* @__PURE__ */ jsx(UserM, {}), color: theme.palette["grey-500"] });
45
+ icon = iconElement || /* @__PURE__ */ jsx(Icon, { component: size === "small" ? /* @__PURE__ */ jsx(UserS, {}) : /* @__PURE__ */ jsx(UserM, {}), color: "var(--ds-color-icon-base-subtle)" });
50
46
  }
51
47
  const [avatarBackgroundColor, avatarBackgroundHue] = getColorByText(avatarText, useDefaultSvg ? void 0 : backgroundColor);
52
48
  const avatarRender = /* @__PURE__ */ jsx(Avatar, { iconComponent: icon, iconScale: !useDefaultSvg, shape: "circle", hasStatus: disabled === true ? false : !!badgeStatus, backgroundColor: useDefaultSvg ? void 0 : avatarBackgroundColor, backgroundColorHue: useDefaultSvg ? void 0 : avatarBackgroundHue, size, src: avatar || src, tooltip: avatarTooltip, disabled, style: {
@@ -59,7 +55,5 @@ const UserAvatar = ({
59
55
  return badgeStatus ? /* @__PURE__ */ jsx("span", { style, children: /* @__PURE__ */ jsx(Badge, { status: badgeStatus, children: avatarRender }) }) : avatarRender;
60
56
  };
61
57
  export {
62
- DEFAULT_COLOR,
63
- DEFAULT_COLOR_HUE,
64
58
  UserAvatar as default
65
59
  };
@@ -1,103 +1,103 @@
1
1
  import { ComponentType } from 'react';
2
- export { default as Icon0003 } from './Icon0003';
3
2
  export { default as Icon0001 } from './Icon0001';
4
3
  export { default as Icon0004 } from './Icon0004';
5
4
  export { default as Icon0007 } from './Icon0007';
6
- export { default as Icon0011 } from './Icon0011';
7
- export { default as Icon0014 } from './Icon0014';
8
5
  export { default as Icon0012 } from './Icon0012';
6
+ export { default as Icon0014 } from './Icon0014';
7
+ export { default as Icon0011 } from './Icon0011';
9
8
  export { default as Icon0015 } from './Icon0015';
9
+ export { default as Icon0022 } from './Icon0022';
10
+ export { default as Icon0003 } from './Icon0003';
10
11
  export { default as Icon0024 } from './Icon0024';
12
+ export { default as Icon0029 } from './Icon0029';
11
13
  export { default as Icon0025 } from './Icon0025';
12
14
  export { default as Icon0027 } from './Icon0027';
13
- export { default as Icon0029 } from './Icon0029';
14
15
  export { default as Icon0030 } from './Icon0030';
15
- export { default as Icon0031 } from './Icon0031';
16
16
  export { default as Icon0032 } from './Icon0032';
17
- export { default as Icon0033 } from './Icon0033';
17
+ export { default as Icon0031 } from './Icon0031';
18
18
  export { default as Icon0038 } from './Icon0038';
19
+ export { default as Icon0033 } from './Icon0033';
19
20
  export { default as Icon0039 } from './Icon0039';
20
- export { default as Icon0040 } from './Icon0040';
21
21
  export { default as Icon0041 } from './Icon0041';
22
- export { default as Icon0042 } from './Icon0042';
22
+ export { default as Icon0040 } from './Icon0040';
23
23
  export { default as Icon0043 } from './Icon0043';
24
+ export { default as Icon0042 } from './Icon0042';
24
25
  export { default as Icon0044 } from './Icon0044';
25
- export { default as Icon0048 } from './Icon0048';
26
- export { default as Icon0049 } from './Icon0049';
27
26
  export { default as Icon0050 } from './Icon0050';
28
- export { default as Icon0053 } from './Icon0053';
27
+ export { default as Icon0049 } from './Icon0049';
28
+ export { default as Icon0051 } from './Icon0051';
29
29
  export { default as Icon0054 } from './Icon0054';
30
+ export { default as Icon0053 } from './Icon0053';
30
31
  export { default as Icon0055 } from './Icon0055';
31
32
  export { default as Icon0056 } from './Icon0056';
32
33
  export { default as Icon0058 } from './Icon0058';
33
- export { default as Icon0022 } from './Icon0022';
34
34
  export { default as Icon0060 } from './Icon0060';
35
35
  export { default as Icon0061 } from './Icon0061';
36
- export { default as Icon0066 } from './Icon0066';
37
36
  export { default as Icon0067 } from './Icon0067';
38
37
  export { default as Icon0070 } from './Icon0070';
39
- export { default as Icon0051 } from './Icon0051';
40
38
  export { default as Icon0071 } from './Icon0071';
39
+ export { default as Icon0066 } from './Icon0066';
41
40
  export { default as Icon0073 } from './Icon0073';
42
41
  export { default as Icon0074 } from './Icon0074';
43
42
  export { default as Icon0075 } from './Icon0075';
44
- export { default as Icon0076 } from './Icon0076';
45
- export { default as Icon0078 } from './Icon0078';
43
+ export { default as Icon0048 } from './Icon0048';
46
44
  export { default as Icon0083 } from './Icon0083';
47
- export { default as Icon0084 } from './Icon0084';
45
+ export { default as Icon0078 } from './Icon0078';
48
46
  export { default as Icon0088 } from './Icon0088';
49
- export { default as Icon0089 } from './Icon0089';
47
+ export { default as Icon0082 } from './Icon0082';
48
+ export { default as Icon0084 } from './Icon0084';
49
+ export { default as Icon0077 } from './Icon0077';
50
+ export { default as Icon0076 } from './Icon0076';
50
51
  export { default as Icon0090 } from './Icon0090';
52
+ export { default as Icon0079 } from './Icon0079';
51
53
  export { default as Icon0091 } from './Icon0091';
52
- export { default as Icon0092 } from './Icon0092';
53
- export { default as Icon0095 } from './Icon0095';
54
+ export { default as Icon0089 } from './Icon0089';
54
55
  export { default as Icon0098 } from './Icon0098';
56
+ export { default as Icon0095 } from './Icon0095';
55
57
  export { default as Icon0100 } from './Icon0100';
58
+ export { default as Icon0092 } from './Icon0092';
56
59
  export { default as Icon0101 } from './Icon0101';
57
- export { default as Icon0102 } from './Icon0102';
58
60
  export { default as Icon0103 } from './Icon0103';
61
+ export { default as Icon0102 } from './Icon0102';
59
62
  export { default as Icon0105 } from './Icon0105';
60
63
  export { default as Icon0106 } from './Icon0106';
61
64
  export { default as Icon0107 } from './Icon0107';
62
65
  export { default as Icon0108 } from './Icon0108';
66
+ export { default as Icon0111 } from './Icon0111';
63
67
  export { default as Icon0109 } from './Icon0109';
68
+ export { default as Icon0114 } from './Icon0114';
64
69
  export { default as Icon0110 } from './Icon0110';
65
- export { default as Icon0111 } from './Icon0111';
66
70
  export { default as Icon0112 } from './Icon0112';
67
- export { default as Icon0114 } from './Icon0114';
68
71
  export { default as Icon0115 } from './Icon0115';
69
72
  export { default as Icon0116 } from './Icon0116';
70
73
  export { default as Icon0118 } from './Icon0118';
71
74
  export { default as Icon0119 } from './Icon0119';
75
+ export { default as Icon0124 } from './Icon0124';
72
76
  export { default as Icon0120 } from './Icon0120';
73
77
  export { default as Icon0122 } from './Icon0122';
74
- export { default as Icon0123 } from './Icon0123';
75
- export { default as Icon0124 } from './Icon0124';
76
- export { default as Icon0125 } from './Icon0125';
77
78
  export { default as Icon0126 } from './Icon0126';
78
- export { default as Icon0127 } from './Icon0127';
79
+ export { default as Icon0125 } from './Icon0125';
79
80
  export { default as Icon0128 } from './Icon0128';
80
- export { default as Icon0130 } from './Icon0130';
81
+ export { default as Icon0129 } from './Icon0129';
81
82
  export { default as Icon0132 } from './Icon0132';
82
- export { default as Icon0133 } from './Icon0133';
83
+ export { default as Icon0127 } from './Icon0127';
83
84
  export { default as Icon0134 } from './Icon0134';
84
- export { default as Icon0137 } from './Icon0137';
85
+ export { default as Icon0130 } from './Icon0130';
86
+ export { default as Icon0133 } from './Icon0133';
85
87
  export { default as Icon0138 } from './Icon0138';
86
- export { default as Icon0129 } from './Icon0129';
87
- export { default as Icon0139 } from './Icon0139';
88
+ export { default as Icon0137 } from './Icon0137';
88
89
  export { default as Icon0140 } from './Icon0140';
89
90
  export { default as Icon0141 } from './Icon0141';
90
91
  export { default as Icon0142 } from './Icon0142';
91
92
  export { default as Icon0143 } from './Icon0143';
92
93
  export { default as Icon0144 } from './Icon0144';
94
+ export { default as Icon0146 } from './Icon0146';
95
+ export { default as Icon0139 } from './Icon0139';
93
96
  export { default as Icon0145 } from './Icon0145';
94
- export { default as Icon0147 } from './Icon0147';
95
97
  export { default as Icon0148 } from './Icon0148';
96
- export { default as Icon0146 } from './Icon0146';
97
- export { default as Icon0149 } from './Icon0149';
98
98
  export { default as Icon015 } from './Icon015';
99
- export { default as Icon0082 } from './Icon0082';
100
- export { default as Icon0079 } from './Icon0079';
101
- export { default as Icon0077 } from './Icon0077';
99
+ export { default as Icon0147 } from './Icon0147';
100
+ export { default as Icon0123 } from './Icon0123';
101
+ export { default as Icon0149 } from './Icon0149';
102
102
  export declare const DEFAULT_AVATARS: ComponentType<React.SVGProps<SVGSVGElement>>[];
103
103
  export declare const TOTAL_DEFAULT_AVATARS = 100;
@@ -1,103 +1,103 @@
1
1
  import Icon0003 from "./Icon0003.js";
2
2
  import Icon0001 from "./Icon0001.js";
3
- import Icon0004 from "./Icon0004.js";
4
- import Icon0007 from "./Icon0007.js";
5
- import Icon0012 from "./Icon0012.js";
6
3
  import Icon0011 from "./Icon0011.js";
4
+ import Icon0007 from "./Icon0007.js";
7
5
  import Icon0022 from "./Icon0022.js";
8
- import Icon0024 from "./Icon0024.js";
6
+ import Icon0004 from "./Icon0004.js";
9
7
  import Icon0014 from "./Icon0014.js";
8
+ import Icon0012 from "./Icon0012.js";
9
+ import Icon0024 from "./Icon0024.js";
10
10
  import Icon0015 from "./Icon0015.js";
11
+ import Icon0027 from "./Icon0027.js";
11
12
  import Icon0029 from "./Icon0029.js";
12
13
  import Icon0025 from "./Icon0025.js";
13
- import Icon0027 from "./Icon0027.js";
14
14
  import Icon0030 from "./Icon0030.js";
15
- import Icon0031 from "./Icon0031.js";
16
15
  import Icon0032 from "./Icon0032.js";
17
16
  import Icon0033 from "./Icon0033.js";
18
- import Icon0038 from "./Icon0038.js";
17
+ import Icon0031 from "./Icon0031.js";
19
18
  import Icon0039 from "./Icon0039.js";
20
19
  import Icon0040 from "./Icon0040.js";
21
20
  import Icon0041 from "./Icon0041.js";
22
21
  import Icon0042 from "./Icon0042.js";
22
+ import Icon0038 from "./Icon0038.js";
23
23
  import Icon0044 from "./Icon0044.js";
24
24
  import Icon0043 from "./Icon0043.js";
25
- import Icon0048 from "./Icon0048.js";
26
25
  import Icon0049 from "./Icon0049.js";
26
+ import Icon0053 from "./Icon0053.js";
27
+ import Icon0048 from "./Icon0048.js";
27
28
  import Icon0051 from "./Icon0051.js";
28
29
  import Icon0050 from "./Icon0050.js";
29
- import Icon0054 from "./Icon0054.js";
30
- import Icon0053 from "./Icon0053.js";
31
30
  import Icon0055 from "./Icon0055.js";
32
- import Icon0058 from "./Icon0058.js";
33
31
  import Icon0060 from "./Icon0060.js";
34
- import Icon0056 from "./Icon0056.js";
32
+ import Icon0054 from "./Icon0054.js";
33
+ import Icon0061 from "./Icon0061.js";
35
34
  import Icon0066 from "./Icon0066.js";
35
+ import Icon0073 from "./Icon0073.js";
36
36
  import Icon0067 from "./Icon0067.js";
37
- import Icon0070 from "./Icon0070.js";
38
- import Icon0061 from "./Icon0061.js";
39
37
  import Icon0071 from "./Icon0071.js";
38
+ import Icon0070 from "./Icon0070.js";
39
+ import Icon0076 from "./Icon0076.js";
40
40
  import Icon0074 from "./Icon0074.js";
41
+ import Icon0082 from "./Icon0082.js";
42
+ import Icon0056 from "./Icon0056.js";
43
+ import Icon0079 from "./Icon0079.js";
41
44
  import Icon0075 from "./Icon0075.js";
42
- import Icon0073 from "./Icon0073.js";
43
- import Icon0076 from "./Icon0076.js";
44
45
  import Icon0083 from "./Icon0083.js";
45
46
  import Icon0084 from "./Icon0084.js";
46
- import Icon0088 from "./Icon0088.js";
47
+ import Icon0077 from "./Icon0077.js";
47
48
  import Icon0089 from "./Icon0089.js";
48
- import Icon0078 from "./Icon0078.js";
49
49
  import Icon0090 from "./Icon0090.js";
50
+ import Icon0088 from "./Icon0088.js";
50
51
  import Icon0091 from "./Icon0091.js";
51
52
  import Icon0092 from "./Icon0092.js";
52
- import Icon0095 from "./Icon0095.js";
53
53
  import Icon0098 from "./Icon0098.js";
54
- import Icon0101 from "./Icon0101.js";
54
+ import Icon0095 from "./Icon0095.js";
55
55
  import Icon0100 from "./Icon0100.js";
56
- import Icon0103 from "./Icon0103.js";
56
+ import Icon0058 from "./Icon0058.js";
57
+ import Icon0101 from "./Icon0101.js";
57
58
  import Icon0102 from "./Icon0102.js";
59
+ import Icon0078 from "./Icon0078.js";
58
60
  import Icon0105 from "./Icon0105.js";
59
- import Icon0106 from "./Icon0106.js";
60
- import Icon0109 from "./Icon0109.js";
61
+ import Icon0103 from "./Icon0103.js";
61
62
  import Icon0107 from "./Icon0107.js";
63
+ import Icon0106 from "./Icon0106.js";
64
+ import Icon0108 from "./Icon0108.js";
62
65
  import Icon0110 from "./Icon0110.js";
63
66
  import Icon0111 from "./Icon0111.js";
64
- import Icon0108 from "./Icon0108.js";
65
67
  import Icon0112 from "./Icon0112.js";
66
68
  import Icon0114 from "./Icon0114.js";
69
+ import Icon0118 from "./Icon0118.js";
70
+ import Icon0109 from "./Icon0109.js";
67
71
  import Icon0115 from "./Icon0115.js";
68
72
  import Icon0116 from "./Icon0116.js";
73
+ import Icon0123 from "./Icon0123.js";
69
74
  import Icon0119 from "./Icon0119.js";
70
- import Icon0120 from "./Icon0120.js";
71
- import Icon0118 from "./Icon0118.js";
72
75
  import Icon0122 from "./Icon0122.js";
73
- import Icon0124 from "./Icon0124.js";
74
- import Icon0123 from "./Icon0123.js";
76
+ import Icon0120 from "./Icon0120.js";
75
77
  import Icon0125 from "./Icon0125.js";
76
- import Icon0126 from "./Icon0126.js";
78
+ import Icon0124 from "./Icon0124.js";
77
79
  import Icon0127 from "./Icon0127.js";
80
+ import Icon0126 from "./Icon0126.js";
81
+ import Icon0129 from "./Icon0129.js";
78
82
  import Icon0128 from "./Icon0128.js";
79
83
  import Icon0130 from "./Icon0130.js";
80
- import Icon0129 from "./Icon0129.js";
81
84
  import Icon0132 from "./Icon0132.js";
82
- import Icon0134 from "./Icon0134.js";
83
85
  import Icon0133 from "./Icon0133.js";
86
+ import Icon0134 from "./Icon0134.js";
84
87
  import Icon0137 from "./Icon0137.js";
85
88
  import Icon0138 from "./Icon0138.js";
86
- import Icon0139 from "./Icon0139.js";
87
89
  import Icon0140 from "./Icon0140.js";
88
90
  import Icon0141 from "./Icon0141.js";
89
- import Icon0143 from "./Icon0143.js";
91
+ import Icon0139 from "./Icon0139.js";
90
92
  import Icon0142 from "./Icon0142.js";
93
+ import Icon0143 from "./Icon0143.js";
91
94
  import Icon0144 from "./Icon0144.js";
92
95
  import Icon0145 from "./Icon0145.js";
93
96
  import Icon0146 from "./Icon0146.js";
94
97
  import Icon0147 from "./Icon0147.js";
95
98
  import Icon015 from "./Icon015.js";
96
- import Icon0148 from "./Icon0148.js";
97
99
  import Icon0149 from "./Icon0149.js";
98
- import Icon0077 from "./Icon0077.js";
99
- import Icon0082 from "./Icon0082.js";
100
- import Icon0079 from "./Icon0079.js";
100
+ import Icon0148 from "./Icon0148.js";
101
101
  const DEFAULT_AVATARS = [Icon0001, Icon0003, Icon0004, Icon0007, Icon0011, Icon0012, Icon0014, Icon0015, Icon0022, Icon0024, Icon0025, Icon0027, Icon0029, Icon0030, Icon0031, Icon0032, Icon0033, Icon0038, Icon0039, Icon0040, Icon0041, Icon0042, Icon0043, Icon0044, Icon0048, Icon0049, Icon0050, Icon0051, Icon0053, Icon0054, Icon0055, Icon0056, Icon0058, Icon0060, Icon0061, Icon0066, Icon0067, Icon0070, Icon0071, Icon0073, Icon0074, Icon0075, Icon0076, Icon0077, Icon0078, Icon0079, Icon0082, Icon0083, Icon0084, Icon0088, Icon0089, Icon0090, Icon0091, Icon0092, Icon0095, Icon0098, Icon0100, Icon0101, Icon0102, Icon0103, Icon0105, Icon0106, Icon0107, Icon0108, Icon0109, Icon0110, Icon0111, Icon0112, Icon0114, Icon0115, Icon0116, Icon0118, Icon0119, Icon0120, Icon0122, Icon0123, Icon0124, Icon0125, Icon0126, Icon0127, Icon0128, Icon0129, Icon0130, Icon0132, Icon0133, Icon0134, Icon0137, Icon0138, Icon0139, Icon0140, Icon0141, Icon0142, Icon0143, Icon0144, Icon0145, Icon0146, Icon0147, Icon0148, Icon0149, Icon015];
102
102
  const TOTAL_DEFAULT_AVATARS = 100;
103
103
  export {
package/dist/utils.d.ts CHANGED
@@ -4,7 +4,7 @@ export declare function getUserText(user: UserAvatar, src?: string | null, text?
4
4
  export declare function isIconComponent(component: ReactNode | undefined): boolean;
5
5
  export declare function isSmallIconVariant(iconElement: ReactElement): boolean;
6
6
  export declare function getObjectName(name?: string | null, text?: string): string | null;
7
- export declare function addIconColor(iconComponent: ReactNode, color: string): ReactElement;
7
+ export declare function addIconColor(iconComponent: ReactNode, color?: string): ReactElement;
8
8
  export declare function getColorByText(text: string | null, backgroundColor?: 'auto' | Color | string): [Color, ColorHue];
9
9
  export declare function getDefaultAvatarIndex(userId: string | number, totalAvatars: number): number;
10
10
  export declare function getTooltipProps(tooltip: AvatarProps['tooltip']): TooltipObject;
package/dist/utils.js CHANGED
@@ -49,7 +49,7 @@ function getObjectName(name = "", text = "") {
49
49
  }
50
50
  function addIconColor(iconComponent, color) {
51
51
  let iconElement = iconComponent;
52
- if (iconElement && !iconElement?.props?.color) {
52
+ if (color && iconElement && !iconElement?.props?.color) {
53
53
  iconElement = cloneElement(iconElement, {
54
54
  color
55
55
  });
@@ -60,6 +60,9 @@ function getColorByText(text, backgroundColor) {
60
60
  if (backgroundColor && backgroundColor.indexOf("-") !== -1) {
61
61
  return backgroundColor.split("-");
62
62
  }
63
+ if (!text && backgroundColor && backgroundColor !== "auto") {
64
+ return [backgroundColor, "100"];
65
+ }
63
66
  const autoColor = (typeof text === "string" ? selectColorByLetter(text.slice(0, 1), true) : {})?.color || "grey";
64
67
  const color = text && backgroundColor && backgroundColor !== "auto" ? backgroundColor : autoColor;
65
68
  const hue = text ? "500" : "100";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@synerise/ds-avatar",
3
- "version": "2.0.10",
3
+ "version": "2.1.0",
4
4
  "description": "Avatar UI Component for the Synerise Design System",
5
5
  "license": "ISC",
6
6
  "repository": "synerise/synerise-design",
@@ -43,12 +43,13 @@
43
43
  ],
44
44
  "types": "dist/index.d.ts",
45
45
  "dependencies": {
46
- "@synerise/ds-badge": "^2.0.10",
47
- "@synerise/ds-icon": "^2.2.3",
48
- "@synerise/ds-status": "^2.0.10",
49
- "@synerise/ds-tooltip": "^2.0.10",
50
- "@synerise/ds-typography": "^2.0.10",
51
- "@synerise/ds-utils": "^2.2.2"
46
+ "@synerise/ds-badge": "^2.1.0",
47
+ "@synerise/ds-icon": "^2.3.0",
48
+ "@synerise/ds-status": "^2.1.0",
49
+ "@synerise/ds-tokens": "^2.1.0",
50
+ "@synerise/ds-tooltip": "^2.1.0",
51
+ "@synerise/ds-typography": "^2.1.0",
52
+ "@synerise/ds-utils": "^2.3.0"
52
53
  },
53
54
  "devDependencies": {
54
55
  "@svgr/core": "^8.1.0",
@@ -63,5 +64,5 @@
63
64
  "react": ">=16.9.0 <= 18.3.1",
64
65
  "styled-components": "^5.3.3"
65
66
  },
66
- "gitHead": "5ac0f7dcb7c3995b402c86c087d8f32770f80a1d"
67
+ "gitHead": "5c3d61e30289486d14c7d6becb682e2d4a08ce41"
67
68
  }