@altinn/altinn-components 0.20.1 → 0.20.2
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,71 +1,77 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
import { jsxs as
|
|
3
|
-
import { useState as
|
|
2
|
+
import { jsxs as i, jsx as r, Fragment as f } from "react/jsx-runtime";
|
|
3
|
+
import { useState as F, useMemo as L } from "react";
|
|
4
4
|
import "../../index-L8X2o7IH.js";
|
|
5
5
|
import "../RootProvider/RootProvider.js";
|
|
6
|
-
import { AccountMenu as
|
|
7
|
-
import { AccountButton as
|
|
8
|
-
import { BackButton as
|
|
9
|
-
import { LogoutButton as
|
|
6
|
+
import { AccountMenu as H } from "./AccountMenu.js";
|
|
7
|
+
import { AccountButton as I } from "./AccountButton.js";
|
|
8
|
+
import { BackButton as W } from "./BackButton.js";
|
|
9
|
+
import { LogoutButton as M } from "./LogoutButton.js";
|
|
10
10
|
import "../Search/AutocompleteBase.js";
|
|
11
11
|
import "../Snackbar/useSnackbar.js";
|
|
12
|
-
import { MenuListItem as
|
|
13
|
-
import { Menu as
|
|
14
|
-
import { GlobalMenuBase as
|
|
12
|
+
import { MenuListItem as n } from "../Menu/MenuBase.js";
|
|
13
|
+
import { Menu as k } from "../Menu/Menu.js";
|
|
14
|
+
import { GlobalMenuBase as c, GlobalMenuHeader as g, GlobalMenuFooter as b } from "./GlobalMenuBase.js";
|
|
15
15
|
const S = ({
|
|
16
|
-
accounts:
|
|
17
|
-
accountGroups:
|
|
18
|
-
accountSearch:
|
|
19
|
-
items:
|
|
20
|
-
groups:
|
|
21
|
-
changeLabel:
|
|
16
|
+
accounts: p = [],
|
|
17
|
+
accountGroups: v = {},
|
|
18
|
+
accountSearch: x,
|
|
19
|
+
items: d = [],
|
|
20
|
+
groups: s,
|
|
21
|
+
changeLabel: G = "Change",
|
|
22
22
|
backLabel: B = "Back",
|
|
23
|
-
currentAccount:
|
|
24
|
-
onSelectAccount:
|
|
25
|
-
onClose:
|
|
26
|
-
logoutButton:
|
|
23
|
+
currentAccount: m,
|
|
24
|
+
onSelectAccount: l,
|
|
25
|
+
onClose: t,
|
|
26
|
+
logoutButton: a
|
|
27
27
|
}) => {
|
|
28
|
-
const [
|
|
29
|
-
|
|
30
|
-
},
|
|
31
|
-
|
|
32
|
-
},
|
|
33
|
-
...
|
|
28
|
+
const [T, j] = F(!1), o = () => {
|
|
29
|
+
j((e) => !e);
|
|
30
|
+
}, A = (e) => {
|
|
31
|
+
o(), t == null || t(), l == null || l(e);
|
|
32
|
+
}, h = L(() => d.map((e) => ({
|
|
33
|
+
...e,
|
|
34
34
|
onClick: () => {
|
|
35
|
-
var
|
|
36
|
-
(
|
|
35
|
+
var u;
|
|
36
|
+
(u = e.onClick) == null || u.call(e), t == null || t();
|
|
37
37
|
}
|
|
38
|
-
})), [
|
|
39
|
-
return
|
|
40
|
-
/* @__PURE__ */ r(g, { children: /* @__PURE__ */ r(
|
|
41
|
-
/* @__PURE__ */ r(
|
|
38
|
+
})), [d, t]);
|
|
39
|
+
return T ? /* @__PURE__ */ i(c, { children: [
|
|
40
|
+
/* @__PURE__ */ r(g, { children: /* @__PURE__ */ r(W, { onClick: o, label: B }) }),
|
|
41
|
+
/* @__PURE__ */ r(n, { as: "div", role: "separator" }),
|
|
42
42
|
/* @__PURE__ */ r(
|
|
43
|
-
|
|
43
|
+
H,
|
|
44
44
|
{
|
|
45
|
-
currentAccount:
|
|
46
|
-
accounts:
|
|
47
|
-
accountGroups:
|
|
48
|
-
accountSearch:
|
|
49
|
-
onSelectAccount:
|
|
45
|
+
currentAccount: m,
|
|
46
|
+
accounts: p,
|
|
47
|
+
accountGroups: v,
|
|
48
|
+
accountSearch: x,
|
|
49
|
+
onSelectAccount: A
|
|
50
50
|
}
|
|
51
51
|
)
|
|
52
|
-
] }) :
|
|
52
|
+
] }) : m ? /* @__PURE__ */ i(c, { children: [
|
|
53
53
|
/* @__PURE__ */ r(g, { children: /* @__PURE__ */ r(
|
|
54
|
-
|
|
54
|
+
I,
|
|
55
55
|
{
|
|
56
|
-
account:
|
|
57
|
-
linkText:
|
|
58
|
-
multipleAccounts:
|
|
59
|
-
onClick:
|
|
56
|
+
account: m,
|
|
57
|
+
linkText: G,
|
|
58
|
+
multipleAccounts: p.length > 1,
|
|
59
|
+
onClick: o
|
|
60
60
|
}
|
|
61
61
|
) }),
|
|
62
|
-
/* @__PURE__ */ r(
|
|
63
|
-
/* @__PURE__ */ r(
|
|
64
|
-
|
|
65
|
-
/* @__PURE__ */ r(
|
|
66
|
-
/* @__PURE__ */ r(
|
|
62
|
+
/* @__PURE__ */ r(n, { as: "div", role: "separator" }),
|
|
63
|
+
/* @__PURE__ */ r(k, { groups: s, items: h, theme: "default" }),
|
|
64
|
+
a && /* @__PURE__ */ i(f, { children: [
|
|
65
|
+
/* @__PURE__ */ r(n, { as: "div", role: "separator" }),
|
|
66
|
+
/* @__PURE__ */ r(b, { children: /* @__PURE__ */ r(M, { ...a }) })
|
|
67
67
|
] })
|
|
68
|
-
] }) : /* @__PURE__ */
|
|
68
|
+
] }) : /* @__PURE__ */ i(c, { children: [
|
|
69
|
+
/* @__PURE__ */ r(k, { groups: s, items: h }),
|
|
70
|
+
a && /* @__PURE__ */ i(f, { children: [
|
|
71
|
+
/* @__PURE__ */ r(n, { as: "div", role: "separator" }),
|
|
72
|
+
/* @__PURE__ */ r(b, { children: /* @__PURE__ */ r(M, { ...a }) })
|
|
73
|
+
] })
|
|
74
|
+
] });
|
|
69
75
|
};
|
|
70
76
|
export {
|
|
71
77
|
S as GlobalMenu
|