@altinn/altinn-components 0.42.4 → 0.42.6

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 +1 @@
1
- ._avatar_128b0_1{position:relative;overflow:hidden;box-sizing:border-box}._avatar_128b0_1[data-shape=circle]{border-radius:50%}._avatar_128b0_1[data-shape=square]{border-radius:5%}._avatar_128b0_1[data-outline=true]{outline:1px solid #ffffff;box-sizing:border-box}._shape_128b0_20{display:block;font-size:1em;width:1em;height:1em}._shape_128b0_20[data-variant=outline]{border:1px solid}._label_128b0_31{position:absolute;top:0;right:0;bottom:0;left:0;display:flex;justify-content:center;align-items:center;overflow:hidden;font-size:.575em}._image_128b0_41{display:block;width:100%;height:100%}@supports (-webkit-hyphens: none){._avatar_128b0_1[data-size=lg] ._label_128b0_31{font-size:1.58rem}._avatar_128b0_1[data-size=md] ._label_128b0_31{font-size:1.15rem}._avatar_128b0_1[data-size=sm] ._label_128b0_31{font-size:.85rem}}
1
+ ._avatar_1en7r_1{position:relative;overflow:hidden;box-sizing:border-box}._avatar_1en7r_1[data-shape=circle]{border-radius:50%}._avatar_1en7r_1[data-shape=square]{border-radius:5%}._avatar_1en7r_1{outline:1px solid #ffffff;box-sizing:border-box}._shape_1en7r_20{display:block;font-size:1em;width:1em;height:1em}._shape_1en7r_20[data-variant=outline]{border:1px solid}._label_1en7r_31{position:absolute;top:0;right:0;bottom:0;left:0;display:flex;justify-content:center;align-items:center;overflow:hidden;font-size:.575em}._image_1en7r_41{display:block;width:100%;height:100%}._deletedIcon_1en7r_47{position:absolute;top:0;right:0;bottom:0;left:0;width:100%;height:100%}@supports (-webkit-hyphens: none){._avatar_1en7r_1[data-size=lg] ._label_1en7r_31{font-size:1.58rem}._avatar_1en7r_1[data-size=md] ._label_1en7r_31{font-size:1.15rem}._avatar_1en7r_1[data-size=sm] ._label_1en7r_31{font-size:.85rem}}
@@ -1,61 +1,78 @@
1
1
  "use client";
2
- import { jsx as e, jsxs as x } from "react/jsx-runtime";
2
+ import { jsx as a, jsxs as S } from "react/jsx-runtime";
3
3
  import { c as j } from "../../index-L8X2o7IH.js";
4
- import { useState as A } from "react";
5
- import { Skeleton as E } from "../Skeleton/Skeleton.js";
6
- import { fromStringToColor as I } from "./color.js";
7
- import '../../assets/Avatar.css';const y = "_avatar_128b0_1", q = "_shape_128b0_20", z = "_label_128b0_31", H = "_image_128b0_41", r = {
8
- avatar: y,
9
- shape: q,
10
- label: z,
11
- image: H
12
- }, F = (a) => typeof a == "object" && a !== null && "name" in a, G = ({
13
- type: a = "person",
14
- size: m,
4
+ import { useState as y } from "react";
5
+ import { Skeleton as A } from "../Skeleton/Skeleton.js";
6
+ import { fromStringToColor as E } from "./color.js";
7
+ import '../../assets/Avatar.css';const q = "_avatar_1en7r_1", z = "_shape_1en7r_20", B = "_label_1en7r_31", H = "_image_1en7r_41", L = "_deletedIcon_1en7r_47", r = {
8
+ avatar: q,
9
+ shape: z,
10
+ label: B,
11
+ image: H,
12
+ deletedIcon: L
13
+ }, G = (e) => typeof e == "object" && e !== null && "name" in e, J = ({
14
+ type: e = "person",
15
+ isParent: n,
16
+ isDeleted: m = !1,
17
+ size: h,
15
18
  name: l = "Avatar",
16
- shape: d,
17
- color: u,
18
- variant: o = "solid",
19
- outline: h = !0,
20
- imageUrl: s,
21
- imageUrlAlt: b,
22
- customLabel: _,
23
- loading: n,
24
- className: g,
25
- style: c = {}
19
+ shape: u,
20
+ color: g,
21
+ variant: _,
22
+ imageUrl: t,
23
+ imageUrlAlt: f,
24
+ customLabel: v,
25
+ loading: c,
26
+ className: b,
27
+ style: i = {}
26
28
  }) => {
27
- const [f, v] = A(!1), C = d || a === "person" ? "circle" : "square", N = u || a === "person" ? "light" : "dark", { backgroundColor: i, foregroundColor: p } = I(l, N), S = (l[0] ?? "").toUpperCase(), t = s && !f, k = !n && !t ? {
28
- ...c,
29
- backgroundColor: o === "outline" ? p : i,
30
- color: o === "outline" ? i : p
31
- } : c;
32
- return /* @__PURE__ */ e(
29
+ const [C, I] = y(!1), w = u || e === "person" ? "circle" : "square", x = g || e === "person" ? "light" : "dark";
30
+ let o = _;
31
+ e === "company" && typeof n == "boolean" && (o = n ? "solid" : "outline");
32
+ const { backgroundColor: p, foregroundColor: d } = E(l, x), N = (l[0] ?? "").toUpperCase(), s = t && !C, k = !c && !s ? {
33
+ ...i,
34
+ backgroundColor: o === "outline" ? d : p,
35
+ color: o === "outline" ? p : d
36
+ } : i;
37
+ return /* @__PURE__ */ a(
33
38
  "div",
34
39
  {
35
- className: j(r.avatar, g),
40
+ className: j(r.avatar, b),
36
41
  style: k,
37
- "data-shape": C,
38
- "data-size": m,
39
- "data-outline": h,
42
+ "data-shape": w,
43
+ "data-size": h,
40
44
  "aria-hidden": !0,
41
- children: /* @__PURE__ */ x(E, { loading: n, className: r.shape, variant: "circle", children: [
42
- /* @__PURE__ */ e("div", { className: r.shape, "data-variant": o, children: t && /* @__PURE__ */ e(
45
+ children: /* @__PURE__ */ S(A, { loading: c, className: r.shape, variant: "circle", children: [
46
+ /* @__PURE__ */ a("div", { className: r.shape, "data-variant": o, children: s && /* @__PURE__ */ a(
43
47
  "img",
44
48
  {
45
- src: s,
49
+ src: t,
46
50
  className: r.image,
47
- alt: b || s,
51
+ alt: f || t,
48
52
  onError: () => {
49
- v(!0);
53
+ I(!0);
50
54
  }
51
55
  }
52
56
  ) }),
53
- !t && /* @__PURE__ */ e("span", { className: r.label, children: _ || S })
57
+ !s && /* @__PURE__ */ a("span", { className: r.label, children: v || N }),
58
+ m && /* @__PURE__ */ a(
59
+ "svg",
60
+ {
61
+ "aria-hidden": "true",
62
+ className: r.deletedIcon,
63
+ width: "24",
64
+ height: "24",
65
+ viewBox: "0 0 24 24",
66
+ fill: "none",
67
+ xmlns: "http://www.w3.org/2000/svg",
68
+ children: /* @__PURE__ */ a("path", { d: "M0 24L24 -1.20156e-06", stroke: "currentColor" })
69
+ }
70
+ )
54
71
  ] })
55
72
  }
56
73
  );
57
74
  };
58
75
  export {
59
- G as Avatar,
60
- F as isAvatarProps
76
+ J as Avatar,
77
+ G as isAvatarProps
61
78
  };
@@ -3,22 +3,22 @@ import "../../index-L8X2o7IH.js";
3
3
  import { useState as b } from "react";
4
4
  import "../RootProvider/RootProvider.js";
5
5
  import "../Snackbar/useSnackbar.js";
6
- import { Input as x } from "../Forms/Input.js";
6
+ import { Input as w } from "../Forms/Input.js";
7
7
  import { SettingsItemBase as n } from "./SettingsItemBase.js";
8
- import { SettingsModal as I } from "./SettingsModal.js";
9
- const O = ({
10
- loading: a,
8
+ import { SettingsModal as x } from "./SettingsModal.js";
9
+ const M = ({
10
+ loading: u,
11
11
  variant: f = "default",
12
12
  id: c = "settings",
13
- name: m,
14
- checked: g,
15
- onChange: h,
13
+ name: h,
14
+ checked: m,
15
+ onChange: g,
16
16
  modalProps: e,
17
17
  children: v,
18
18
  ...t
19
19
  }) => {
20
- const [l, u] = b(!1);
21
- if (a)
20
+ const [l, a] = b(!1);
21
+ if (u)
22
22
  return /* @__PURE__ */ i(n, { icon: t == null ? void 0 : t.icon, title: t == null ? void 0 : t.title, loading: !0 });
23
23
  switch (f) {
24
24
  case "switch":
@@ -34,36 +34,61 @@ const O = ({
34
34
  value: void 0,
35
35
  interactive: !1,
36
36
  controls: /* @__PURE__ */ i(
37
- x,
37
+ w,
38
38
  {
39
39
  type: "checkbox",
40
40
  role: "switch",
41
41
  "aria-labelledby": c,
42
- name: m,
42
+ name: h,
43
43
  value: t == null ? void 0 : t.value,
44
- checked: g,
45
- onChange: h,
44
+ checked: m,
45
+ onChange: g,
46
46
  style: { marginRight: "0.5em" }
47
47
  }
48
48
  )
49
49
  }
50
50
  );
51
51
  case "modal":
52
- return /* @__PURE__ */ i(n, { ...t, as: "button", linkIcon: !0, onClick: () => u(!0), expanded: l, children: l && /* @__PURE__ */ i(
53
- I,
52
+ return /* @__PURE__ */ i(
53
+ n,
54
54
  {
55
- ...e,
56
- icon: (e == null ? void 0 : e.icon) || (t == null ? void 0 : t.icon),
57
- title: (e == null ? void 0 : e.title) || (t == null ? void 0 : t.title),
58
- open: l,
59
- onClose: () => u(!1),
60
- children: v
55
+ ...t,
56
+ title: {
57
+ variant: "subtle",
58
+ weight: "normal",
59
+ children: t == null ? void 0 : t.title
60
+ },
61
+ as: "button",
62
+ linkIcon: !0,
63
+ onClick: () => a(!0),
64
+ expanded: l,
65
+ children: l && /* @__PURE__ */ i(
66
+ x,
67
+ {
68
+ ...e,
69
+ icon: (e == null ? void 0 : e.icon) || (t == null ? void 0 : t.icon),
70
+ title: (e == null ? void 0 : e.title) || (t == null ? void 0 : t.title),
71
+ open: l,
72
+ onClose: () => a(!1),
73
+ children: v
74
+ }
75
+ )
61
76
  }
62
- ) });
77
+ );
63
78
  default:
64
- return /* @__PURE__ */ i(n, { ...t });
79
+ return /* @__PURE__ */ i(
80
+ n,
81
+ {
82
+ ...t,
83
+ title: {
84
+ variant: "subtle",
85
+ weight: "normal",
86
+ children: t == null ? void 0 : t.title
87
+ }
88
+ }
89
+ );
65
90
  }
66
91
  };
67
92
  export {
68
- O as SettingsItem
93
+ M as SettingsItem
69
94
  };
@@ -13,6 +13,7 @@ export interface AccountListItemProps extends ListItemProps, AccountListItemCont
13
13
  accountIds?: string[];
14
14
  isCurrentEndUser?: boolean;
15
15
  isDeleted?: boolean;
16
+ isParent?: boolean;
16
17
  contextMenu?: ContextMenuProps;
17
18
  label?: string;
18
19
  }
@@ -25,6 +25,7 @@ declare const meta: {
25
25
  accountIds?: string[] | undefined;
26
26
  isCurrentEndUser?: boolean | undefined;
27
27
  isDeleted?: boolean | undefined;
28
+ isParent?: boolean | undefined;
28
29
  contextMenu?: import('..').ContextMenuProps | undefined;
29
30
  label?: string | undefined;
30
31
  variant?: import('..').ListItemVariant | undefined;
@@ -14,6 +14,10 @@ export interface AvatarProps {
14
14
  name: string;
15
15
  /** The type of avatar. */
16
16
  type?: AvatarType;
17
+ /** Company is a parent. */
18
+ isParent?: boolean;
19
+ /** Company is a deleted. */
20
+ isDeleted?: boolean;
17
21
  /** Avatar shape. */
18
22
  shape?: AvatarColor;
19
23
  /** Avatar color. */
@@ -41,4 +45,4 @@ export declare const isAvatarProps: (icon: unknown) => icon is AvatarProps;
41
45
  /**
42
46
  * Avatar component to display user or company avatars with various customization options.
43
47
  */
44
- export declare const Avatar: ({ type, size, name, shape, color, variant, outline, imageUrl, imageUrlAlt, customLabel, loading, className, style, }: AvatarProps) => ReactElement;
48
+ export declare const Avatar: ({ type, isParent, isDeleted, size, name, shape, color, variant, imageUrl, imageUrlAlt, customLabel, loading, className, style, }: 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, shape, color, variant, outline, imageUrl, imageUrlAlt, customLabel, loading, className, style, }: AvatarProps) => React.ReactElement;
5
+ component: ({ type, isParent, isDeleted, size, name, shape, color, variant, imageUrl, imageUrlAlt, customLabel, loading, className, style, }: AvatarProps) => React.ReactElement;
6
6
  tags: string[];
7
7
  parameters: {
8
8
  layout: string;
@@ -10,12 +10,21 @@ declare const meta: {
10
10
  args: {
11
11
  name: string;
12
12
  type: "person";
13
+ style: {
14
+ fontSize: string;
15
+ width: string;
16
+ height: string;
17
+ };
13
18
  };
14
19
  };
15
20
  export default meta;
16
21
  type Story = StoryObj<typeof meta>;
17
22
  export declare const Person: Story;
18
23
  export declare const Company: Story;
24
+ export declare const CompanyOutline: Story;
25
+ export declare const DeletedCompany: Story;
26
+ export declare const Subunit: Story;
27
+ export declare const DeletedSubunit: Story;
19
28
  export declare const Logo: Story;
20
29
  export declare const Loading: Story;
21
30
  export declare const Sizes: ({ type, name, imageUrl }: AvatarProps) => import("react/jsx-runtime").JSX.Element;
@@ -21,6 +21,8 @@ declare const meta: {
21
21
  size?: "sm" | "md" | undefined;
22
22
  name: string;
23
23
  type?: import('..').AvatarType | undefined;
24
+ isParent?: boolean | undefined;
25
+ isDeleted?: boolean | undefined;
24
26
  shape?: import('..').AvatarColor | undefined;
25
27
  color?: import('..').AvatarColor | undefined;
26
28
  variant?: import('..').AvatarVariant | undefined;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@altinn/altinn-components",
3
- "version": "0.42.4",
3
+ "version": "0.42.6",
4
4
  "main": "dist/index.js",
5
5
  "files": [
6
6
  "dist/",