@altinn/altinn-components 0.33.6 → 0.33.7

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.
@@ -1,15 +1,15 @@
1
1
  "use client";
2
- import { jsx as s, jsxs as x } from "react/jsx-runtime";
2
+ import { jsx as s, jsxs as y } from "react/jsx-runtime";
3
3
  import { c as C } from "../../index-L8X2o7IH.js";
4
4
  import { useState as S } from "react";
5
5
  import { Skeleton as j } from "../Skeleton/Skeleton.js";
6
- import { fromStringToColor as y } from "./color.js";
7
- import '../../assets/Avatar.css';const A = "_avatar_1k073_1", E = "_shape_1k073_20", I = "_label_1k073_27", q = "_image_1k073_37", r = {
8
- avatar: A,
9
- shape: E,
10
- label: I,
11
- image: q
12
- }, B = (a) => typeof a == "object" && a !== null && "name" in a, D = ({
6
+ import { fromStringToColor as A } from "./color.js";
7
+ import '../../assets/Avatar.css';const E = "_avatar_1k073_1", I = "_shape_1k073_20", q = "_label_1k073_27", z = "_image_1k073_37", r = {
8
+ avatar: E,
9
+ shape: I,
10
+ label: q,
11
+ image: z
12
+ }, D = (a) => typeof a == "object" && a !== null && "name" in a, F = ({
13
13
  type: a = "person",
14
14
  size: i,
15
15
  name: o = "Avatar",
@@ -20,40 +20,42 @@ import '../../assets/Avatar.css';const A = "_avatar_1k073_1", E = "_shape_1k073_
20
20
  loading: l,
21
21
  className: d,
22
22
  style: c = {},
23
- innerContainerStyle: h = {}
23
+ innerContainerStyle: h = {},
24
+ avatarImageStyle: u = {}
24
25
  }) => {
25
- const [u, v] = S(!1), _ = a === "person" ? "circle" : "square", f = a === "person" ? "light" : "dark", { backgroundColor: g, foregroundColor: k } = y(o, f), b = (o[0] ?? "").toUpperCase(), t = e && !u, N = !l && !t ? {
26
+ const [v, _] = S(!1), f = a === "person" ? "circle" : "square", g = a === "person" ? "light" : "dark", { backgroundColor: k, foregroundColor: b } = A(o, g), N = (o[0] ?? "").toUpperCase(), t = e && !v, x = !l && !t ? {
26
27
  ...c,
27
- backgroundColor: g,
28
- color: k
28
+ backgroundColor: k,
29
+ color: b
29
30
  } : c;
30
31
  return /* @__PURE__ */ s(
31
32
  "div",
32
33
  {
33
34
  className: C(r.avatar, { [r.outline]: n }, d),
34
- style: N,
35
- "data-variant": _,
35
+ style: x,
36
+ "data-variant": f,
36
37
  "data-size": i,
37
38
  "data-outline": n,
38
39
  "aria-hidden": !0,
39
- children: /* @__PURE__ */ x(j, { loading: l, className: r.shape, variant: "circle", children: [
40
+ children: /* @__PURE__ */ y(j, { loading: l, className: r.shape, variant: "circle", children: [
40
41
  /* @__PURE__ */ s("div", { className: r.shape, style: h, children: t && /* @__PURE__ */ s(
41
42
  "img",
42
43
  {
43
44
  src: e,
44
45
  className: r.image,
45
46
  alt: m || e,
47
+ style: u,
46
48
  onError: () => {
47
- v(!0);
49
+ _(!0);
48
50
  }
49
51
  }
50
52
  ) }),
51
- !t && /* @__PURE__ */ s("span", { className: r.label, children: p || b })
53
+ !t && /* @__PURE__ */ s("span", { className: r.label, children: p || N })
52
54
  ] })
53
55
  }
54
56
  );
55
57
  };
56
58
  export {
57
- D as Avatar,
58
- B as isAvatarProps
59
+ F as Avatar,
60
+ D as isAvatarProps
59
61
  };
@@ -7,33 +7,34 @@ import "../RootProvider/RootProvider.js";
7
7
  import { Skeleton as l } from "../Skeleton/Skeleton.js";
8
8
  import "../Searchbar/AutocompleteBase.js";
9
9
  import "../Snackbar/useSnackbar.js";
10
- import '../../assets/Byline.css';const d = "_byline_zacbk_1", y = "_avatar_zacbk_7", f = "_avatarGroup_zacbk_11", k = "_label_zacbk_19", t = {
10
+ import '../../assets/Byline.css';const d = "_byline_zacbk_1", y = "_avatar_zacbk_7", h = "_avatarGroup_zacbk_11", u = "_label_zacbk_19", t = {
11
11
  byline: d,
12
12
  avatar: y,
13
- avatarGroup: f,
14
- label: k
15
- }, w = ({
13
+ avatarGroup: h,
14
+ label: u
15
+ }, A = ({
16
16
  loading: n,
17
17
  color: i = "neutral",
18
- size: r = "xs",
19
- avatar: e,
18
+ size: e = "xs",
19
+ avatar: r,
20
20
  avatarGroup: o,
21
- datetime: c,
22
- children: m,
21
+ datetime: m,
22
+ children: c,
23
23
  as: s,
24
24
  ...p
25
- }) => /* @__PURE__ */ b(s || "div", { ...p, className: t.byline, "data-color": i, "data-size": r, children: [
26
- (o || e) && /* @__PURE__ */ a(l, { variant: "circle", className: t.avatar, loading: n, children: o ? /* @__PURE__ */ a(v, { ...o, size: r, className: t.avatarGroup }) : e && /* @__PURE__ */ a(
25
+ }) => /* @__PURE__ */ b(s || "div", { ...p, className: t.byline, "data-color": i, "data-size": e, children: [
26
+ (o || r) && /* @__PURE__ */ a(l, { variant: "circle", className: t.avatar, loading: n, children: o ? /* @__PURE__ */ a(v, { ...o, size: e, className: t.avatarGroup }) : r && /* @__PURE__ */ a(
27
27
  _,
28
28
  {
29
- ...e,
30
- size: r,
29
+ ...r,
30
+ size: e,
31
31
  className: t.avatar,
32
- innerContainerStyle: { width: "fit-content" }
32
+ innerContainerStyle: { width: "fit-content" },
33
+ avatarImageStyle: { height: "1em", width: "auto" }
33
34
  }
34
35
  ) }),
35
- /* @__PURE__ */ a("time", { "data-size": r, dateTime: c, className: t.label, children: /* @__PURE__ */ a(l, { loading: n, children: m }) })
36
+ /* @__PURE__ */ a("time", { "data-size": e, dateTime: m, className: t.label, children: /* @__PURE__ */ a(l, { loading: n, children: c }) })
36
37
  ] });
37
38
  export {
38
- w as Byline
39
+ A as Byline
39
40
  };
@@ -25,10 +25,13 @@ export interface AvatarProps {
25
25
  style?: CSSProperties;
26
26
  /** Whether the avatar is loading. */
27
27
  loading?: boolean;
28
+ /** Avatar image container styles */
28
29
  innerContainerStyle?: CSSProperties;
30
+ /** Avatar image inner styles */
31
+ avatarImageStyle?: CSSProperties;
29
32
  }
30
33
  export declare const isAvatarProps: (icon: unknown) => icon is AvatarProps;
31
34
  /**
32
35
  * Avatar component to display user or company avatars with various customization options.
33
36
  */
34
- export declare const Avatar: ({ type, size, name, outline, imageUrl, imageUrlAlt, customLabel, loading, className, style, innerContainerStyle, }: AvatarProps) => ReactElement;
37
+ export declare const Avatar: ({ type, size, name, outline, imageUrl, imageUrlAlt, customLabel, loading, className, style, innerContainerStyle, avatarImageStyle, }: AvatarProps) => ReactElement;
@@ -2,7 +2,7 @@ import { StoryObj } from '@storybook/react-vite';
2
2
  import { AvatarProps } from '..';
3
3
  declare const meta: {
4
4
  title: string;
5
- component: ({ type, size, name, outline, imageUrl, imageUrlAlt, customLabel, loading, className, style, innerContainerStyle, }: AvatarProps) => React.ReactElement;
5
+ component: ({ type, size, name, outline, imageUrl, imageUrlAlt, customLabel, loading, className, style, innerContainerStyle, avatarImageStyle, }: AvatarProps) => React.ReactElement;
6
6
  tags: string[];
7
7
  parameters: {
8
8
  layout: string;
@@ -29,6 +29,7 @@ declare const meta: {
29
29
  style?: React.CSSProperties | undefined;
30
30
  loading?: boolean | undefined;
31
31
  innerContainerStyle?: React.CSSProperties | undefined;
32
+ avatarImageStyle?: React.CSSProperties | undefined;
32
33
  }>) => import("react/jsx-runtime").JSX.Element)[];
33
34
  };
34
35
  export default meta;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@altinn/altinn-components",
3
- "version": "0.33.6",
3
+ "version": "0.33.7",
4
4
  "main": "dist/index.js",
5
5
  "files": [
6
6
  "dist/",