@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.
- package/dist/components/Account/AccountMenuButton.js +47 -47
- package/dist/components/Account/AccountOrganization.js +26 -23
- package/dist/types/lib/components/Account/AccountMenuButton.stories.d.ts +1 -0
- package/dist/types/lib/components/Account/AccountOrganization.stories.d.ts +12 -2
- package/package.json +1 -1
|
@@ -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
|
|
5
|
-
import { Avatar as
|
|
6
|
-
import { ButtonBase as
|
|
7
|
-
import { ButtonLabel as
|
|
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
|
|
12
|
-
import { u as
|
|
13
|
-
import '../../assets/AccountMenuButton.css';var
|
|
14
|
-
var
|
|
15
|
-
for (var e in t) Object.prototype.hasOwnProperty.call(t, e) && o.indexOf(e) < 0 && (
|
|
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
|
|
18
|
-
o.indexOf(e[
|
|
19
|
-
return
|
|
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
|
|
22
|
-
var { title:
|
|
23
|
-
let r =
|
|
24
|
-
return r =
|
|
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 },
|
|
27
|
-
|
|
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
|
-
}),
|
|
31
|
-
button:
|
|
32
|
-
avatarIcon:
|
|
33
|
-
loginIcon:
|
|
34
|
-
closeIcon:
|
|
35
|
-
avatar:
|
|
36
|
-
icon:
|
|
37
|
-
labelContainer:
|
|
38
|
-
description:
|
|
39
|
-
},
|
|
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:
|
|
42
|
+
expanded: l,
|
|
43
43
|
minimized: e = !1,
|
|
44
|
-
loading:
|
|
44
|
+
loading: i = !1,
|
|
45
45
|
...r
|
|
46
46
|
}) => {
|
|
47
|
-
const c =
|
|
48
|
-
if (
|
|
47
|
+
const { languageCode: _ } = I(), c = M(_);
|
|
48
|
+
if (i)
|
|
49
49
|
return /* @__PURE__ */ a(
|
|
50
|
-
|
|
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(
|
|
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
|
-
|
|
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":
|
|
74
|
+
"aria-label": l ? c.close : o.name,
|
|
75
75
|
children: [
|
|
76
|
-
!e && /* @__PURE__ */ a(
|
|
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" ||
|
|
78
|
+
/* @__PURE__ */ a("span", { className: n.description, children: typeof s == "string" || h(s) ? s : null })
|
|
79
79
|
] }) }),
|
|
80
|
-
|
|
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(
|
|
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
|
|
92
|
-
|
|
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(
|
|
103
|
-
/* @__PURE__ */ a(u, { className: n.loginIcon, icon: /* @__PURE__ */ a(
|
|
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
|
-
},
|
|
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
|
-
|
|
130
|
+
J as AccountMenuButton
|
|
131
131
|
};
|
|
@@ -1,30 +1,33 @@
|
|
|
1
|
-
import { jsx as n, jsxs as
|
|
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
|
|
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
|
|
8
|
-
list:
|
|
9
|
-
node:
|
|
10
|
-
link:
|
|
11
|
-
},
|
|
12
|
-
avatar:
|
|
13
|
-
title:
|
|
14
|
-
as:
|
|
15
|
-
description:
|
|
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
|
-
...
|
|
18
|
-
}) =>
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
] })
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
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
|
-
|
|
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: {};
|