@altinn/altinn-components 0.50.2 → 0.50.4

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
- ._badges_hp9nk_1{display:flex;flex-direction:row;gap:.5rem;flex-wrap:wrap;justify-content:start;margin-bottom:auto;margin-top:calc(var(--dsc-item-my) * .85)}._label_hp9nk_11{display:flex;flex-direction:row;align-items:center;gap:.5rem}
1
+ ._badges_1csip_1{display:flex;flex-direction:row;gap:.5rem;flex-wrap:wrap;justify-content:start;margin-bottom:auto;margin-top:calc(var(--dsc-item-my) * .85)}._label_1csip_11{display:flex;flex-direction:row;align-items:center;gap:.5rem;min-width:0;flex:1;overflow:hidden}._label_1csip_11>span{min-width:0;flex:1;overflow:hidden}._label_1csip_11 span[data-size]{overflow:hidden}._label_1csip_11 span[data-size] span[data-variant=subtle]{display:-webkit-box;-webkit-line-clamp:1;line-clamp:1;-webkit-box-orient:vertical;overflow:hidden;text-overflow:ellipsis;white-space:normal}._description_1csip_42{overflow:hidden;text-overflow:ellipsis;white-space:nowrap;width:100%;min-width:0}
@@ -1,53 +1,53 @@
1
1
  "use client";
2
2
  import { jsx as a, jsxs as d } from "react/jsx-runtime";
3
3
  import { c as m } from "../../index-L8X2o7IH.js";
4
- import f, { forwardRef as _, isValidElement as v } from "react";
5
- import { Avatar as b } from "../Avatar/Avatar.js";
6
- import { ButtonBase as p } from "../Button/ButtonBase.js";
7
- import { ButtonLabel as g } from "../Button/ButtonLabel.js";
4
+ import f, { forwardRef as v, isValidElement as h } from "react";
5
+ import { Avatar as p } from "../Avatar/Avatar.js";
6
+ import { ButtonBase as g } from "../Button/ButtonBase.js";
7
+ import { ButtonLabel as b } from "../Button/ButtonLabel.js";
8
8
  import { ButtonIcon as u } from "../Button/ButtonIcon.js";
9
- import "../RootProvider/RootProvider.js";
9
+ import { useRootContext as I } from "../RootProvider/RootProvider.js";
10
10
  import "../Snackbar/useSnackbar.js";
11
- import { S as h } from "../../XMark-tKk6aExO.js";
12
- import { u as I } from "../../useId-BVFxCjkq.js";
13
- import '../../assets/AccountMenuButton.css';var w = function(t, o) {
14
- var i = {};
15
- for (var e in t) Object.prototype.hasOwnProperty.call(t, e) && o.indexOf(e) < 0 && (i[e] = t[e]);
11
+ import { S as w } from "../../XMark-tKk6aExO.js";
12
+ import { u as y } from "../../useId-BVFxCjkq.js";
13
+ import '../../assets/AccountMenuButton.css';var N = function(t, o) {
14
+ var l = {};
15
+ for (var e in t) Object.prototype.hasOwnProperty.call(t, e) && o.indexOf(e) < 0 && (l[e] = t[e]);
16
16
  if (t != null && typeof Object.getOwnPropertySymbols == "function")
17
- for (var l = 0, e = Object.getOwnPropertySymbols(t); l < e.length; l++)
18
- o.indexOf(e[l]) < 0 && Object.prototype.propertyIsEnumerable.call(t, e[l]) && (i[e[l]] = t[e[l]]);
19
- return i;
17
+ for (var i = 0, e = Object.getOwnPropertySymbols(t); i < e.length; i++)
18
+ o.indexOf(e[i]) < 0 && Object.prototype.propertyIsEnumerable.call(t, e[i]) && (l[e[i]] = t[e[i]]);
19
+ return l;
20
20
  };
21
- const y = _((t, o) => {
22
- var { title: i, titleId: e } = t, l = w(t, ["title", "titleId"]);
23
- let r = I();
24
- return r = i ? e || "title-" + r : void 0, f.createElement(
21
+ const x = v((t, o) => {
22
+ var { title: l, titleId: e } = t, i = N(t, ["title", "titleId"]);
23
+ let r = y();
24
+ return r = l ? e || "title-" + r : void 0, f.createElement(
25
25
  "svg",
26
- Object.assign({ xmlns: "http://www.w3.org/2000/svg", width: "1em", height: "1em", fill: "none", viewBox: "0 0 24 24", focusable: !1, role: "img", ref: o, "aria-labelledby": r }, l),
27
- i ? f.createElement("title", { id: r }, i) : null,
26
+ Object.assign({ xmlns: "http://www.w3.org/2000/svg", width: "1em", height: "1em", fill: "none", viewBox: "0 0 24 24", focusable: !1, role: "img", ref: o, "aria-labelledby": r }, i),
27
+ l ? f.createElement("title", { id: r }, l) : null,
28
28
  f.createElement("path", { fill: "currentColor", fillRule: "evenodd", d: "M15.5 3.25a.75.75 0 0 0 0 1.5H19a.25.25 0 0 1 .25.25v14a.25.25 0 0 1-.25.25h-3.5a.75.75 0 0 0 0 1.5H19A1.75 1.75 0 0 0 20.75 19V5A1.75 1.75 0 0 0 19 3.25zM9.97 6.97a.75.75 0 0 1 1.06 0l4.5 4.5a.75.75 0 0 1 0 1.06l-4.5 4.5a.75.75 0 1 1-1.06-1.06l3.22-3.22H3.5a.75.75 0 0 1 0-1.5h9.69L9.97 8.03a.75.75 0 0 1 0-1.06", clipRule: "evenodd" })
29
29
  );
30
- }), N = "_button_1r4wq_1", x = "_avatarIcon_1r4wq_18", O = "_loginIcon_1r4wq_19", q = "_closeIcon_1r4wq_20", j = "_avatar_1r4wq_18", k = "_icon_1r4wq_43", L = "_labelContainer_1r4wq_55", B = "_description_1r4wq_63", n = {
31
- button: N,
32
- avatarIcon: x,
33
- loginIcon: O,
34
- closeIcon: q,
35
- avatar: j,
36
- icon: k,
37
- labelContainer: L,
38
- description: B
39
- }, F = ({
30
+ }), O = "_button_1r4wq_1", q = "_avatarIcon_1r4wq_18", C = "_loginIcon_1r4wq_19", j = "_closeIcon_1r4wq_20", k = "_avatar_1r4wq_18", L = "_icon_1r4wq_43", B = "_labelContainer_1r4wq_55", E = "_description_1r4wq_63", n = {
31
+ button: O,
32
+ avatarIcon: q,
33
+ loginIcon: C,
34
+ closeIcon: j,
35
+ avatar: k,
36
+ icon: L,
37
+ labelContainer: B,
38
+ description: E
39
+ }, J = ({
40
40
  className: t,
41
41
  currentAccount: o,
42
- expanded: i,
42
+ expanded: l,
43
43
  minimized: e = !1,
44
- loading: l = !1,
44
+ loading: i = !1,
45
45
  ...r
46
46
  }) => {
47
- const c = C(void 0);
48
- if (l)
47
+ const { languageCode: _ } = I(), c = M(_);
48
+ if (i)
49
49
  return /* @__PURE__ */ a(
50
- p,
50
+ g,
51
51
  {
52
52
  ...r,
53
53
  as: "button",
@@ -57,13 +57,13 @@ const y = _((t, o) => {
57
57
  className: m(n.button, n.loading, t),
58
58
  disabled: !0,
59
59
  "aria-label": "loading",
60
- children: /* @__PURE__ */ a(u, { className: n.avatarIcon, icon: /* @__PURE__ */ a(b, { name: "loading", loading: !0, className: n.avatar }) })
60
+ children: /* @__PURE__ */ a(u, { className: n.avatarIcon, icon: /* @__PURE__ */ a(p, { name: "loading", loading: !0, className: n.avatar }) })
61
61
  }
62
62
  );
63
63
  if (o) {
64
64
  let s = o.description;
65
65
  return o.type === "subunit" && typeof s == "string" && s && (s = `${s.split(",")[0]}, ${c.subunit}`), /* @__PURE__ */ d(
66
- p,
66
+ g,
67
67
  {
68
68
  ...r,
69
69
  as: "button",
@@ -71,25 +71,25 @@ const y = _((t, o) => {
71
71
  variant: "text",
72
72
  color: "accent",
73
73
  className: m(n.button, t),
74
- "aria-label": i ? c.close : o.name,
74
+ "aria-label": l ? c.close : o.name,
75
75
  children: [
76
- !e && /* @__PURE__ */ a(g, { children: /* @__PURE__ */ d("div", { className: n.labelContainer, children: [
76
+ !e && /* @__PURE__ */ a(b, { children: /* @__PURE__ */ d("div", { className: n.labelContainer, children: [
77
77
  o.name,
78
- /* @__PURE__ */ a("span", { className: n.description, children: typeof s == "string" || v(s) ? s : null })
78
+ /* @__PURE__ */ a("span", { className: n.description, children: typeof s == "string" || h(s) ? s : null })
79
79
  ] }) }),
80
- i ? /* @__PURE__ */ a(u, { className: n.closeIcon, icon: /* @__PURE__ */ a(h, { className: n.icon, "aria-hidden": !0 }) }) : /* @__PURE__ */ a(
80
+ l ? /* @__PURE__ */ a(u, { className: n.closeIcon, icon: /* @__PURE__ */ a(w, { className: n.icon, "aria-hidden": !0 }) }) : /* @__PURE__ */ a(
81
81
  u,
82
82
  {
83
83
  className: n.avatarIcon,
84
- icon: /* @__PURE__ */ a(b, { ...o == null ? void 0 : o.icon, className: n.avatar })
84
+ icon: /* @__PURE__ */ a(p, { ...o == null ? void 0 : o.icon, className: n.avatar })
85
85
  }
86
86
  )
87
87
  ]
88
88
  }
89
89
  );
90
90
  }
91
- return i ? null : /* @__PURE__ */ d(
92
- p,
91
+ return l ? null : /* @__PURE__ */ d(
92
+ g,
93
93
  {
94
94
  ...r,
95
95
  as: "button",
@@ -99,12 +99,12 @@ const y = _((t, o) => {
99
99
  "aria-label": c.login,
100
100
  className: m(n.button, t),
101
101
  children: [
102
- !e && /* @__PURE__ */ a(g, { children: c.login }),
103
- /* @__PURE__ */ a(u, { className: n.loginIcon, icon: /* @__PURE__ */ a(y, { className: n.icon, "aria-hidden": !0 }) })
102
+ !e && /* @__PURE__ */ a(b, { children: c.login }),
103
+ /* @__PURE__ */ a(u, { className: n.loginIcon, icon: /* @__PURE__ */ a(x, { className: n.icon, "aria-hidden": !0 }) })
104
104
  ]
105
105
  }
106
106
  );
107
- }, C = (t) => {
107
+ }, M = (t) => {
108
108
  switch (t) {
109
109
  case "nn":
110
110
  return {
@@ -127,5 +127,5 @@ const y = _((t, o) => {
127
127
  }
128
128
  };
129
129
  export {
130
- F as AccountMenuButton
130
+ J as AccountMenuButton
131
131
  };
@@ -1,30 +1,33 @@
1
- import { jsx as n, jsxs as c } from "react/jsx-runtime";
1
+ import { jsx as n, jsxs as o } from "react/jsx-runtime";
2
2
  import "../../index-L8X2o7IH.js";
3
3
  import "react";
4
- import { Byline as d } from "../Byline/Byline.js";
4
+ import { Byline as p } from "../Byline/Byline.js";
5
5
  import "../RootProvider/RootProvider.js";
6
6
  import "../Snackbar/useSnackbar.js";
7
- import '../../assets/AccountOrganization.css';const m = "_list_hvcdj_1", p = "_node_hvcdj_19", h = "_link_hvcdj_37", i = {
8
- list: m,
9
- node: p,
10
- link: h
11
- }, a = ({
12
- avatar: t,
13
- title: l,
14
- as: o,
15
- description: s,
7
+ import '../../assets/AccountOrganization.css';const h = "_list_hvcdj_1", _ = "_node_hvcdj_19", u = "_link_hvcdj_37", l = {
8
+ list: h,
9
+ node: _,
10
+ link: u
11
+ }, c = ({
12
+ avatar: e,
13
+ title: t,
14
+ as: s,
15
+ description: i,
16
16
  selected: r,
17
- ...e
18
- }) => /* @__PURE__ */ n(r ? "span" : o || "a", { ...e, className: i.link, "data-selected": r, children: /* @__PURE__ */ c(d, { size: "sm", avatar: t, children: [
19
- /* @__PURE__ */ c("strong", { children: [
20
- l,
21
- s && ","
22
- ] }),
23
- s
24
- ] }) }), u = ({ items: t, level: l }) => /* @__PURE__ */ n("ul", { "data-level": l, className: i.list, children: t.map((o, s) => /* @__PURE__ */ n("li", { children: /* @__PURE__ */ n("span", { className: i.node, "data-level": l, children: /* @__PURE__ */ n(a, { ...o }) }) }, s)) }), x = ({ items: t, level: l = 1 }) => /* @__PURE__ */ n("ul", { "data-level": l, className: i.list, children: t == null ? void 0 : t.map((o, s) => /* @__PURE__ */ c("li", { children: [
25
- /* @__PURE__ */ n(a, { ...o }),
26
- o.items && /* @__PURE__ */ n(u, { items: o.items, level: l + 1 })
27
- ] }, s)) });
17
+ ...a
18
+ }) => {
19
+ const m = r ? "span" : s || "a", { items: v, ...d } = a;
20
+ return /* @__PURE__ */ n(m, { ...d, className: l.link, "data-selected": r, children: /* @__PURE__ */ o(p, { size: "sm", avatar: e, children: [
21
+ /* @__PURE__ */ o("strong", { children: [
22
+ t,
23
+ i && ","
24
+ ] }),
25
+ i
26
+ ] }) });
27
+ }, j = ({ items: e, level: t }) => /* @__PURE__ */ n("ul", { "data-level": t, className: l.list, children: e.map((s, i) => /* @__PURE__ */ n("li", { children: /* @__PURE__ */ n("span", { className: l.node, "data-level": t, children: /* @__PURE__ */ n(c, { ...s }) }) }, i)) }), O = ({ items: e = [], level: t = 1 }) => /* @__PURE__ */ n("ul", { "data-level": t, className: l.list, children: e.map((s, i) => /* @__PURE__ */ o("li", { children: [
28
+ /* @__PURE__ */ n(c, { ...s }),
29
+ s.items && /* @__PURE__ */ n(j, { items: s.items, level: t + 1 })
30
+ ] }, i)) });
28
31
  export {
29
- x as AccountOrganization
32
+ O as AccountOrganization
30
33
  };
@@ -1,12 +1,12 @@
1
1
  "use client";
2
- import { jsx as s, jsxs as u } from "react/jsx-runtime";
2
+ import { jsx as n, jsxs as u } from "react/jsx-runtime";
3
3
  import { Badge as y } from "../Badge/Badge.js";
4
4
  import "../../index-L8X2o7IH.js";
5
- import m, { forwardRef as h } from "react";
5
+ import m, { forwardRef as v } from "react";
6
6
  import "../RootProvider/RootProvider.js";
7
7
  import "../Snackbar/useSnackbar.js";
8
- import { ListItemLabel as v } from "../List/ListItemLabel.js";
9
- import { ListItem as g } from "../List/ListItem.js";
8
+ import { ListItemLabel as g } from "../List/ListItemLabel.js";
9
+ import { ListItem as h } from "../List/ListItem.js";
10
10
  import { u as _ } from "../../useId-BVFxCjkq.js";
11
11
  import '../../assets/UserListItem.css';var w = function(e, r) {
12
12
  var l = {};
@@ -16,16 +16,16 @@ import '../../assets/UserListItem.css';var w = function(e, r) {
16
16
  r.indexOf(t[a]) < 0 && Object.prototype.propertyIsEnumerable.call(e, t[a]) && (l[t[a]] = e[t[a]]);
17
17
  return l;
18
18
  };
19
- const O = h((e, r) => {
19
+ const O = v((e, r) => {
20
20
  var { title: l, titleId: t } = e, a = w(e, ["title", "titleId"]);
21
- let o = _();
22
- return o = l ? t || "title-" + o : void 0, m.createElement(
21
+ let i = _();
22
+ return i = l ? t || "title-" + i : void 0, m.createElement(
23
23
  "svg",
24
- Object.assign({ xmlns: "http://www.w3.org/2000/svg", width: "1em", height: "1em", fill: "none", viewBox: "0 0 24 24", focusable: !1, role: "img", ref: r, "aria-labelledby": o }, a),
25
- l ? m.createElement("title", { id: o }, l) : null,
24
+ Object.assign({ xmlns: "http://www.w3.org/2000/svg", width: "1em", height: "1em", fill: "none", viewBox: "0 0 24 24", focusable: !1, role: "img", ref: r, "aria-labelledby": i }, a),
25
+ l ? m.createElement("title", { id: i }, l) : null,
26
26
  m.createElement("path", { fill: "currentColor", fillRule: "evenodd", d: "M11.625 2.35a.75.75 0 0 1 .75 0l7.794 4.5a.75.75 0 0 1 .375.65v9a.75.75 0 0 1-.375.65l-7.779 4.49a.75.75 0 0 1-.39.11h-.006a.76.76 0 0 1-.373-.103L3.83 17.15a.75.75 0 0 1-.375-.65V7.494a.75.75 0 0 1 .382-.648zm-.375 17.351-6.294-3.634V8.799l3.486 2.013a3.751 3.751 0 0 0 2.808 4.863zM15.75 12a3.75 3.75 0 0 1-3 3.675v4.026l6.294-3.634V8.799l-3.486 2.013c.124.373.192.773.192 1.188m-1.79-1.105a2.25 2.25 0 1 1-3.919-.003l.01-.017.01-.016a2.249 2.249 0 0 1 3.9.036m.847-1.382L18.294 7.5 12 3.866 5.706 7.5l3.487 2.013A3.74 3.74 0 0 1 12 8.25a3.74 3.74 0 0 1 2.807 1.263", clipRule: "evenodd" })
27
27
  );
28
- }), I = "_badges_hp9nk_1", j = "_label_hp9nk_11", f = {
28
+ }), I = "_badges_1csip_1", j = "_label_1csip_11", f = {
29
29
  badges: I,
30
30
  label: j
31
31
  }, B = ({
@@ -34,37 +34,37 @@ const O = h((e, r) => {
34
34
  description: l,
35
35
  roleNames: t,
36
36
  titleAs: a = "h3",
37
- subUnit: o = !1,
37
+ subUnit: i = !1,
38
38
  loading: c = !1,
39
- ...n
39
+ ...s
40
40
  }) => {
41
- let i;
41
+ let o;
42
42
  switch (r) {
43
43
  case "person":
44
- i = { name: e, type: "person" };
44
+ o = { name: e, type: "person" };
45
45
  break;
46
46
  case "company":
47
- i = { name: e, type: "company", isParent: !o };
47
+ o = { name: e, type: "company", isParent: !i };
48
48
  break;
49
49
  case "system":
50
- i = O;
50
+ o = O;
51
51
  break;
52
52
  default:
53
- i = { name: e, type: "person" };
53
+ o = { name: e, type: "person" };
54
54
  }
55
- const b = !c && t ? /* @__PURE__ */ s("div", { className: f.badges, children: t.map((d) => /* @__PURE__ */ s(y, { label: d, color: n.color, children: d }, d)) }) : void 0, p = /* @__PURE__ */ u("div", { className: f.label, "data-size": n.size, children: [
56
- /* @__PURE__ */ s(
57
- v,
55
+ const b = !c && t ? /* @__PURE__ */ n("div", { className: f.badges, children: t.map((d) => /* @__PURE__ */ n(y, { label: d, color: s.color, children: d }, d)) }) : void 0, p = /* @__PURE__ */ u("div", { className: f.label, "data-size": s.size, children: [
56
+ /* @__PURE__ */ n(
57
+ g,
58
58
  {
59
59
  title: { children: e, as: a },
60
60
  description: l,
61
- size: n.size,
61
+ size: s.size,
62
62
  loading: c
63
63
  }
64
64
  ),
65
65
  b
66
66
  ] });
67
- return /* @__PURE__ */ s(g, { icon: i, ariaLabel: e, label: p, description: l, loading: c, ...n });
67
+ return /* @__PURE__ */ n(h, { icon: o, ariaLabel: e, label: p, description: l, loading: c, ...s });
68
68
  };
69
69
  export {
70
70
  B as UserListItem
@@ -24,6 +24,7 @@ declare const meta: {
24
24
  export default meta;
25
25
  type Story = StoryObj<typeof meta>;
26
26
  export declare const Login: Story;
27
+ export declare const LoginWithEnglishText: () => import("react/jsx-runtime").JSX.Element;
27
28
  export declare const Person: Story;
28
29
  export declare const Company: Story;
29
30
  export declare const Expanded: Story;
@@ -12,15 +12,25 @@ declare const meta: {
12
12
  name: string;
13
13
  };
14
14
  selected: true;
15
- items: {
15
+ items: ({
16
16
  title: string;
17
17
  description: string;
18
18
  avatar: {
19
19
  type: "company";
20
20
  name: string;
21
21
  variant: "outline";
22
+ isDeleted?: undefined;
22
23
  };
23
- }[];
24
+ } | {
25
+ title: string;
26
+ description: string;
27
+ avatar: {
28
+ type: "company";
29
+ name: string;
30
+ variant: "outline";
31
+ isDeleted: true;
32
+ };
33
+ })[];
24
34
  }[];
25
35
  };
26
36
  parameters: {};
@@ -115,5 +115,6 @@ export default meta;
115
115
  export declare const Default: (args: UserListItemProps) => import("react/jsx-runtime").JSX.Element;
116
116
  export declare const MultipleRoles: (args: UserListItemProps) => import("react/jsx-runtime").JSX.Element;
117
117
  export declare const WithSubUnits: (args: UserListItemProps) => import("react/jsx-runtime").JSX.Element;
118
+ export declare const WithInheritingParties: (args: UserListItemProps) => import("react/jsx-runtime").JSX.Element;
118
119
  export declare const DifferentHeadingLevelsAndSizes: (args: UserListItemProps) => import("react/jsx-runtime").JSX.Element;
119
120
  export declare const WithControls: (args: UserListItemProps) => import("react/jsx-runtime").JSX.Element;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@altinn/altinn-components",
3
- "version": "0.50.2",
3
+ "version": "0.50.4",
4
4
  "main": "dist/index.js",
5
5
  "files": [
6
6
  "dist/",