@altinn/altinn-components 0.50.3 → 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,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
  };
@@ -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: {};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@altinn/altinn-components",
3
- "version": "0.50.3",
3
+ "version": "0.50.4",
4
4
  "main": "dist/index.js",
5
5
  "files": [
6
6
  "dist/",