@altinn/altinn-components 0.42.3 → 0.42.5

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_9mmgv_1{position:relative;overflow:hidden;box-sizing:border-box}._avatar_9mmgv_1[data-shape=circle]{border-radius:50%}._avatar_9mmgv_1[data-shape=square]{border-radius:5%}._avatar_9mmgv_1[data-outline=true]{outline:1px solid #ffffff;box-sizing:border-box}._shape_9mmgv_20{display:block;font-size:1em;width:1em;height:1em}._shape_9mmgv_20[data-variant=outline]{border:1px solid}._label_9mmgv_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_9mmgv_41{display:block;width:100%;height:100%}._deletedIcon_9mmgv_47{position:absolute;top:0;right:0;bottom:0;left:0;width:100%;height:100%}@supports (-webkit-hyphens: none){._avatar_9mmgv_1[data-size=lg] ._label_9mmgv_31{font-size:1.58rem}._avatar_9mmgv_1[data-size=md] ._label_9mmgv_31{font-size:1.15rem}._avatar_9mmgv_1[data-size=sm] ._label_9mmgv_31{font-size:.85rem}}
@@ -1 +1 @@
1
- ._button_234vz_1{flex-shrink:0;position:relative;z-index:2;display:inline-flex;align-items:center;column-gap:.625rem;padding:.625rem;border:none;border-radius:4px}._label_234vz_13{font-size:1.125rem;font-weight:500;padding:.25rem}._loginIcon_234vz_19,._closeIcon_234vz_20,._avatar_234vz_21{font-size:1.5rem;width:2.25rem;height:2.25rem;border-radius:2px}._loginIcon_234vz_19{background-color:#fff;color:#000}._closeIcon_234vz_20{outline:1px solid white}._badge_234vz_37{position:absolute;top:0;right:0;margin-top:-.75rem;margin-right:-.75rem}@supports (-webkit-hyphens: none){._loginIcon_234vz_19,._closeIcon_234vz_20,._avatar_234vz_21{font-size:unset}._loginIcon_234vz_19 svg,._loginIcon_234vz_19 img,._closeIcon_234vz_20 svg,._closeIcon_234vz_20 img{width:1.5rem;height:1.5rem}}
1
+ ._button_1uh95_1{flex-shrink:0;position:relative;z-index:2;display:inline-flex;align-items:center;column-gap:.625rem;padding:.625rem;border:none;border-radius:4px}._label_1uh95_13{font-size:1.125rem;font-weight:500;padding:.25rem}._avatarIcon_1uh95_19,._loginIcon_1uh95_20,._closeIcon_1uh95_21{width:2.25rem;height:2.25rem;border-radius:2px;font-size:unset}._closeIcon_1uh95_21{outline:1px solid white}._loginIcon_1uh95_20{background-color:#fff;color:#000;outline:1px solid white}._avatar_1uh95_19{font-size:2.25rem;width:2.25rem;height:2.25rem}._icon_1uh95_44{font-size:1.5rem;width:1.5rem;height:1.5rem}._badge_1uh95_50{position:absolute;top:0;right:0;margin-top:-.75rem;margin-right:-.75rem}
@@ -1,61 +1,77 @@
1
1
  "use client";
2
- import { jsx as e, jsxs as x } from "react/jsx-runtime";
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,
2
+ import { jsx as a, jsxs as j } from "react/jsx-runtime";
3
+ import { c as A } from "../../index-L8X2o7IH.js";
4
+ import { useState as E } from "react";
5
+ import { Skeleton as y } from "../Skeleton/Skeleton.js";
6
+ import { fromStringToColor as q } from "./color.js";
7
+ import '../../assets/Avatar.css';const z = "_avatar_9mmgv_1", B = "_shape_9mmgv_20", H = "_label_9mmgv_31", L = "_image_9mmgv_41", M = "_deletedIcon_9mmgv_47", r = {
8
+ avatar: z,
9
+ shape: B,
10
+ label: H,
11
+ image: L,
12
+ deletedIcon: M
13
+ }, G = (e) => typeof e == "object" && e !== null && "name" in e, J = ({
14
+ type: e = "person",
15
+ isParent: d = !0,
16
+ isDeleted: p = !1,
17
+ size: h,
15
18
  name: l = "Avatar",
16
- shape: d,
19
+ shape: g,
17
20
  color: u,
18
- variant: o = "solid",
19
- outline: h = !0,
20
- imageUrl: s,
21
- imageUrlAlt: b,
22
- customLabel: _,
21
+ variant: v,
22
+ outline: _ = !0,
23
+ imageUrl: t,
24
+ imageUrlAlt: f,
25
+ customLabel: b,
23
26
  loading: n,
24
- className: g,
27
+ className: C,
25
28
  style: c = {}
26
29
  }) => {
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 ? {
30
+ const [I, w] = E(!1), x = g || e === "person" ? "circle" : "square", N = u || e === "person" ? "light" : "dark", o = v || !d ? "outline" : "solid", { backgroundColor: i, foregroundColor: m } = q(l, N), k = (l[0] ?? "").toUpperCase(), s = t && !I, S = !n && !s ? {
28
31
  ...c,
29
- backgroundColor: o === "outline" ? p : i,
30
- color: o === "outline" ? i : p
32
+ backgroundColor: o === "outline" ? m : i,
33
+ color: o === "outline" ? i : m
31
34
  } : c;
32
- return /* @__PURE__ */ e(
35
+ return /* @__PURE__ */ a(
33
36
  "div",
34
37
  {
35
- className: j(r.avatar, g),
36
- style: k,
37
- "data-shape": C,
38
- "data-size": m,
39
- "data-outline": h,
38
+ className: A(r.avatar, C),
39
+ style: S,
40
+ "data-shape": x,
41
+ "data-size": h,
42
+ "data-outline": _,
40
43
  "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(
44
+ children: /* @__PURE__ */ j(y, { loading: n, className: r.shape, variant: "circle", children: [
45
+ /* @__PURE__ */ a("div", { className: r.shape, "data-variant": o, children: s && /* @__PURE__ */ a(
43
46
  "img",
44
47
  {
45
- src: s,
48
+ src: t,
46
49
  className: r.image,
47
- alt: b || s,
50
+ alt: f || t,
48
51
  onError: () => {
49
- v(!0);
52
+ w(!0);
50
53
  }
51
54
  }
52
55
  ) }),
53
- !t && /* @__PURE__ */ e("span", { className: r.label, children: _ || S })
56
+ !s && /* @__PURE__ */ a("span", { className: r.label, children: b || k }),
57
+ p && /* @__PURE__ */ a(
58
+ "svg",
59
+ {
60
+ "aria-hidden": "true",
61
+ className: r.deletedIcon,
62
+ width: "24",
63
+ height: "24",
64
+ viewBox: "0 0 24 24",
65
+ fill: "none",
66
+ xmlns: "http://www.w3.org/2000/svg",
67
+ children: /* @__PURE__ */ a("path", { d: "M0 24L24 -1.20156e-06", stroke: "currentColor" })
68
+ }
69
+ )
54
70
  ] })
55
71
  }
56
72
  );
57
73
  };
58
74
  export {
59
- G as Avatar,
60
- F as isAvatarProps
75
+ J as Avatar,
76
+ G as isAvatarProps
61
77
  };
@@ -1,49 +1,58 @@
1
- import { jsxs as r, jsx as o } from "react/jsx-runtime";
1
+ import { jsxs as l, jsx as o } from "react/jsx-runtime";
2
2
  import { c as _ } from "../../index-L8X2o7IH.js";
3
3
  import "react";
4
- import { Badge as d } from "../Badge/Badge.js";
5
- import { ButtonBase as I } from "../Button/ButtonBase.js";
6
- import { ButtonLabel as f } from "../Button/ButtonLabel.js";
7
- import { ButtonIcon as p } from "../Button/ButtonIcon.js";
4
+ import { Avatar as u } from "../Avatar/Avatar.js";
5
+ import { Badge as I } from "../Badge/Badge.js";
6
+ import { ButtonBase as h } from "../Button/ButtonBase.js";
7
+ import { ButtonLabel as d } from "../Button/ButtonLabel.js";
8
+ import { ButtonIcon as f } from "../Button/ButtonIcon.js";
8
9
  import "../RootProvider/RootProvider.js";
9
10
  import "../Snackbar/useSnackbar.js";
10
- import { S as v } from "../../XMark-tKk6aExO.js";
11
- import { S as N } from "../../PadlockLocked-XL1IB5Ae.js";
12
- import '../../assets/GlobalMenuButton.css';const b = "_button_234vz_1", h = "_loginIcon_234vz_19", B = "_closeIcon_234vz_20", z = "_avatar_234vz_21", u = "_badge_234vz_37", a = {
13
- button: b,
14
- loginIcon: h,
15
- closeIcon: B,
16
- avatar: z,
17
- badge: u
18
- }, w = ({
11
+ import { S as N } from "../../XMark-tKk6aExO.js";
12
+ import { S as g } from "../../PadlockLocked-XL1IB5Ae.js";
13
+ import '../../assets/GlobalMenuButton.css';const v = "_button_1uh95_1", b = "_avatarIcon_1uh95_19", B = "_loginIcon_1uh95_20", x = "_closeIcon_1uh95_21", S = "_avatar_1uh95_19", k = "_icon_1uh95_44", L = "_badge_1uh95_50", a = {
14
+ button: v,
15
+ avatarIcon: b,
16
+ loginIcon: B,
17
+ closeIcon: x,
18
+ avatar: S,
19
+ icon: k,
20
+ badge: L
21
+ }, H = ({
19
22
  className: t,
20
- as: c = "button",
23
+ as: s = "button",
21
24
  color: i = "accent",
22
- variant: e = "solid",
23
- currentAccount: s,
24
- expanded: g,
25
- label: l = "Menu",
25
+ variant: m = "solid",
26
+ currentAccount: c,
27
+ expanded: p,
28
+ label: r = "Menu",
26
29
  badge: n,
27
- ...m
28
- }) => g ? /* @__PURE__ */ r(I, { ...m, as: c, variant: e, color: i, className: _(a.button, t), children: [
29
- /* @__PURE__ */ o(f, { children: l }),
30
- /* @__PURE__ */ o(p, { className: a.closeIcon, icon: /* @__PURE__ */ o(v, { className: a.icon, "aria-label": "Close Icon" }) }),
31
- n && /* @__PURE__ */ o(d, { ...n, className: a.badge })
32
- ] }) : s ? /* @__PURE__ */ r(I, { ...m, as: c, variant: e, color: i, className: _(a.button, t), children: [
33
- /* @__PURE__ */ o(f, { children: l }),
34
- /* @__PURE__ */ o(p, { className: a.avatar, icon: s == null ? void 0 : s.icon }),
35
- n && /* @__PURE__ */ o(d, { ...n, className: a.badge })
36
- ] }) : /* @__PURE__ */ r(I, { ...m, as: c, variant: e, color: i, className: _(a.button, t), children: [
37
- /* @__PURE__ */ o(f, { children: l }),
30
+ ...e
31
+ }) => p ? /* @__PURE__ */ l(h, { ...e, as: s, variant: m, color: i, className: _(a.button, t), children: [
32
+ /* @__PURE__ */ o(d, { children: r }),
33
+ /* @__PURE__ */ o(f, { className: a.closeIcon, icon: /* @__PURE__ */ o(N, { className: a.icon, "aria-label": "Close Icon" }) }),
34
+ n && /* @__PURE__ */ o(I, { ...n, className: a.badge })
35
+ ] }) : c ? /* @__PURE__ */ l(h, { ...e, as: s, variant: m, color: i, className: _(a.button, t), children: [
36
+ /* @__PURE__ */ o(d, { children: r }),
38
37
  /* @__PURE__ */ o(
39
- p,
38
+ f,
39
+ {
40
+ className: a.avatarIcon,
41
+ icon: /* @__PURE__ */ o(u, { ...c == null ? void 0 : c.icon, className: a.avatar })
42
+ }
43
+ ),
44
+ n && /* @__PURE__ */ o(I, { ...n, className: a.badge })
45
+ ] }) : /* @__PURE__ */ l(h, { ...e, as: s, variant: m, color: i, className: _(a.button, t), children: [
46
+ /* @__PURE__ */ o(d, { children: r }),
47
+ /* @__PURE__ */ o(
48
+ f,
40
49
  {
41
50
  className: a.loginIcon,
42
- icon: /* @__PURE__ */ o(N, { className: a.icon, "aria-label": "Login Icon" })
51
+ icon: /* @__PURE__ */ o(g, { className: a.icon, "aria-label": "Login Icon" })
43
52
  }
44
53
  ),
45
- n && /* @__PURE__ */ o(d, { ...n, className: a.badge })
54
+ n && /* @__PURE__ */ o(I, { ...n, className: a.badge })
46
55
  ] });
47
56
  export {
48
- w as GlobalMenuButton
57
+ H as GlobalMenuButton
49
58
  };
@@ -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, outline, 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, outline, imageUrl, imageUrlAlt, customLabel, loading, className, style, }: AvatarProps) => React.ReactElement;
6
6
  tags: string[];
7
7
  parameters: {
8
8
  layout: string;
@@ -10,12 +10,20 @@ 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 DeletedCompany: Story;
25
+ export declare const Subunit: Story;
26
+ export declare const DeletedSubunit: Story;
19
27
  export declare const Logo: Story;
20
28
  export declare const Loading: Story;
21
29
  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.3",
3
+ "version": "0.42.5",
4
4
  "main": "dist/index.js",
5
5
  "files": [
6
6
  "dist/",