@altinn/altinn-components 0.38.5 → 0.38.6
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/GlobalMenu/GlobalMenu.js +57 -56
- package/dist/components/Header/Header.js +75 -50
- package/dist/components/Header/index.js +12 -8
- package/dist/components/index.js +313 -309
- package/dist/index.js +329 -325
- package/dist/types/lib/components/GlobalMenu/GlobalMenu.d.ts +3 -4
- package/dist/types/lib/components/GlobalMenu/GlobalMenu.stories.d.ts +4 -4
- package/dist/types/lib/components/Header/Header.d.ts +7 -3
- package/dist/types/lib/components/Header/Header.stories.d.ts +7 -5
- package/dist/types/lib/components/Header/index.d.ts +2 -0
- package/dist/types/lib/stories/InboxBeta.stories.d.ts +1 -0
- package/package.json +1 -1
|
@@ -1,88 +1,89 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
import { jsxs as
|
|
3
|
-
import { useState as
|
|
2
|
+
import { jsxs as p, jsx as r, Fragment as v } from "react/jsx-runtime";
|
|
3
|
+
import { useState as b, useMemo as q } from "react";
|
|
4
4
|
import "../../index-L8X2o7IH.js";
|
|
5
|
-
import { AccountMenu as
|
|
5
|
+
import { AccountMenu as w } from "../Account/AccountMenu.js";
|
|
6
6
|
import "../RootProvider/RootProvider.js";
|
|
7
|
-
import { CurrentAccount as
|
|
8
|
-
import { BackButton as
|
|
9
|
-
import { LogoutButton as
|
|
10
|
-
import { EndUserLabel as
|
|
7
|
+
import { CurrentAccount as z } from "./CurrentAccount.js";
|
|
8
|
+
import { BackButton as D } from "./BackButton.js";
|
|
9
|
+
import { LogoutButton as j } from "./LogoutButton.js";
|
|
10
|
+
import { EndUserLabel as B } from "./EndUserLabel.js";
|
|
11
11
|
import { MenuListItem as f } from "../Menu/MenuBase.js";
|
|
12
|
-
import { Menu as
|
|
12
|
+
import { Menu as F } from "../Menu/Menu.js";
|
|
13
13
|
import "../Snackbar/useSnackbar.js";
|
|
14
|
-
import { GlobalMenuBase as
|
|
15
|
-
const
|
|
16
|
-
accountMenu:
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
backLabel: H = "Back",
|
|
14
|
+
import { GlobalMenuBase as e, GlobalMenuHeader as J, GlobalMenuFooter as M } from "./GlobalMenuBase.js";
|
|
15
|
+
const E = ({
|
|
16
|
+
accountMenu: s,
|
|
17
|
+
menu: l,
|
|
18
|
+
backLabel: T = "Back",
|
|
20
19
|
currentAccount: d,
|
|
21
|
-
currentEndUserLabel:
|
|
22
|
-
onSelectAccount:
|
|
20
|
+
currentEndUserLabel: h = "Signed in",
|
|
21
|
+
onSelectAccount: o,
|
|
23
22
|
onClose: a,
|
|
24
23
|
logoutButton: t,
|
|
25
|
-
ariaLabel:
|
|
24
|
+
ariaLabel: k = "Menu"
|
|
26
25
|
}) => {
|
|
27
26
|
var x;
|
|
28
|
-
const [
|
|
29
|
-
|
|
30
|
-
},
|
|
31
|
-
|
|
32
|
-
}, G =
|
|
27
|
+
const [H, S] = b(!1), g = () => {
|
|
28
|
+
S((i) => !i);
|
|
29
|
+
}, W = (i) => {
|
|
30
|
+
g(), a == null || a(), o == null || o(i);
|
|
31
|
+
}, G = q(() => ((l == null ? void 0 : l.items) ?? []).map((i) => ({
|
|
33
32
|
...i,
|
|
34
33
|
onClick: () => {
|
|
35
|
-
var
|
|
36
|
-
(
|
|
34
|
+
var m;
|
|
35
|
+
(m = i.onClick) == null || m.call(i), a == null || a();
|
|
37
36
|
},
|
|
38
|
-
items: Array.isArray(i.items) ? i.items.map((
|
|
39
|
-
...
|
|
37
|
+
items: Array.isArray(i.items) ? i.items.map((m) => ({
|
|
38
|
+
...m,
|
|
40
39
|
onClick: () => {
|
|
41
40
|
var y;
|
|
42
|
-
(y =
|
|
41
|
+
(y = m.onClick) == null || y.call(m), a == null || a();
|
|
43
42
|
}
|
|
44
43
|
})) : void 0
|
|
45
|
-
})), [
|
|
46
|
-
if (
|
|
47
|
-
return /* @__PURE__ */
|
|
48
|
-
/* @__PURE__ */ r(
|
|
44
|
+
})), [l, a]);
|
|
45
|
+
if (H)
|
|
46
|
+
return /* @__PURE__ */ p(e, { "aria-label": k, children: [
|
|
47
|
+
/* @__PURE__ */ r(J, { children: /* @__PURE__ */ r(D, { onClick: g, label: T }) }),
|
|
49
48
|
/* @__PURE__ */ r(f, { as: "div", role: "separator" }),
|
|
50
|
-
|
|
49
|
+
s && /* @__PURE__ */ r(w, { ...s, currentAccount: d, onSelectAccount: W })
|
|
51
50
|
] });
|
|
52
51
|
if (d) {
|
|
53
|
-
const i =
|
|
54
|
-
return /* @__PURE__ */
|
|
55
|
-
/* @__PURE__ */
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
52
|
+
const i = s && ((x = s == null ? void 0 : s.items) == null ? void 0 : x.length) > 1;
|
|
53
|
+
return /* @__PURE__ */ p(e, { "aria-label": k, color: d == null ? void 0 : d.type, children: [
|
|
54
|
+
d && /* @__PURE__ */ p(v, { children: [
|
|
55
|
+
/* @__PURE__ */ r(
|
|
56
|
+
z,
|
|
57
|
+
{
|
|
58
|
+
account: d,
|
|
59
|
+
multipleAccounts: i,
|
|
60
|
+
as: i ? "button" : "div",
|
|
61
|
+
onClick: i ? g : void 0
|
|
62
|
+
}
|
|
63
|
+
),
|
|
64
|
+
/* @__PURE__ */ r(f, { as: "div", role: "separator" })
|
|
65
|
+
] }),
|
|
66
|
+
l && /* @__PURE__ */ r(F, { ...l, items: G }),
|
|
67
|
+
t && /* @__PURE__ */ p(v, { children: [
|
|
67
68
|
/* @__PURE__ */ r(f, { as: "div", role: "separator" }),
|
|
68
|
-
/* @__PURE__ */
|
|
69
|
-
|
|
70
|
-
/* @__PURE__ */ r(
|
|
69
|
+
/* @__PURE__ */ p(M, { children: [
|
|
70
|
+
h && /* @__PURE__ */ r(B, { children: h }),
|
|
71
|
+
/* @__PURE__ */ r(j, { ...t })
|
|
71
72
|
] })
|
|
72
73
|
] })
|
|
73
74
|
] });
|
|
74
75
|
}
|
|
75
|
-
return /* @__PURE__ */
|
|
76
|
-
/* @__PURE__ */ r(
|
|
77
|
-
t && /* @__PURE__ */
|
|
76
|
+
return /* @__PURE__ */ p(e, { "aria-label": k, children: [
|
|
77
|
+
l && /* @__PURE__ */ r(F, { ...l, items: G }),
|
|
78
|
+
t && /* @__PURE__ */ p(v, { children: [
|
|
78
79
|
/* @__PURE__ */ r(f, { as: "div", role: "separator" }),
|
|
79
|
-
/* @__PURE__ */
|
|
80
|
-
|
|
81
|
-
/* @__PURE__ */ r(
|
|
80
|
+
/* @__PURE__ */ p(M, { children: [
|
|
81
|
+
h && /* @__PURE__ */ r(B, { children: h }),
|
|
82
|
+
/* @__PURE__ */ r(j, { ...t })
|
|
82
83
|
] })
|
|
83
84
|
] })
|
|
84
85
|
] });
|
|
85
86
|
};
|
|
86
87
|
export {
|
|
87
|
-
|
|
88
|
+
E as GlobalMenu
|
|
88
89
|
};
|
|
@@ -1,73 +1,98 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
import { jsxs as
|
|
3
|
-
import { DropdownBase as C } from "../Dropdown/DropdownBase.js";
|
|
2
|
+
import { jsxs as n, jsx as o } from "react/jsx-runtime";
|
|
4
3
|
import "../../index-L8X2o7IH.js";
|
|
5
|
-
import { DrawerBase as b } from "../Dropdown/DrawerBase.js";
|
|
6
4
|
import "react";
|
|
7
|
-
import { useRootContext as
|
|
8
|
-
import {
|
|
9
|
-
import {
|
|
10
|
-
import {
|
|
11
|
-
import {
|
|
12
|
-
import {
|
|
13
|
-
import {
|
|
14
|
-
import "
|
|
15
|
-
import { HeaderGroup as D } from "./HeaderGroup.js";
|
|
5
|
+
import { useRootContext as k } from "../RootProvider/RootProvider.js";
|
|
6
|
+
import { DropdownBase as B } from "../Dropdown/DropdownBase.js";
|
|
7
|
+
import { DrawerBase as D } from "../Dropdown/DrawerBase.js";
|
|
8
|
+
import { GlobalMenu as f } from "../GlobalMenu/GlobalMenu.js";
|
|
9
|
+
import { GlobalMenuButton as I } from "../GlobalMenu/GlobalMenuButton.js";
|
|
10
|
+
import { HeaderBase as N } from "./HeaderBase.js";
|
|
11
|
+
import { HeaderLogo as u } from "./HeaderLogo.js";
|
|
12
|
+
import { HeaderGroup as F } from "./HeaderGroup.js";
|
|
16
13
|
import { HeaderSearch as w } from "./HeaderSearch.js";
|
|
17
|
-
import {
|
|
18
|
-
import
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
14
|
+
import { LocaleSwitcher as G } from "./LocaleSwitcher.js";
|
|
15
|
+
import { Searchbar as x } from "../Searchbar/Searchbar.js";
|
|
16
|
+
import "../Snackbar/useSnackbar.js";
|
|
17
|
+
import { useIsDesktop as L } from "../../hooks/useIsDesktop.js";
|
|
18
|
+
import '../../assets/Header.css';const j = "_drawer_1tael_1", y = "_dropdown_1tael_6", R = "_relative_1tael_20", t = {
|
|
19
|
+
drawer: j,
|
|
20
|
+
dropdown: y,
|
|
21
|
+
relative: R
|
|
22
|
+
}, A = ({
|
|
23
|
+
globalMenu: e,
|
|
24
|
+
desktopMenu: _,
|
|
25
|
+
mobileMenu: C,
|
|
26
|
+
locale: p,
|
|
27
|
+
search: s,
|
|
28
|
+
currentAccount: m,
|
|
29
|
+
logo: l = {},
|
|
30
|
+
badge: v
|
|
31
|
+
}) => {
|
|
32
|
+
const { currentId: r, toggleId: i, openId: H, closeAll: d } = k(), c = () => {
|
|
33
|
+
H("search");
|
|
34
|
+
}, a = () => {
|
|
35
|
+
i("search");
|
|
36
|
+
}, S = () => {
|
|
37
|
+
i("menu");
|
|
38
|
+
}, h = L();
|
|
39
|
+
return /* @__PURE__ */ n(
|
|
40
|
+
N,
|
|
32
41
|
{
|
|
33
|
-
currentId:
|
|
34
|
-
open:
|
|
35
|
-
onClose:
|
|
42
|
+
currentId: r,
|
|
43
|
+
open: r === "search" || r === "menu" || r === "locale",
|
|
44
|
+
onClose: d,
|
|
36
45
|
children: [
|
|
37
|
-
/* @__PURE__ */
|
|
38
|
-
|
|
39
|
-
/* @__PURE__ */
|
|
40
|
-
|
|
41
|
-
/* @__PURE__ */
|
|
42
|
-
/* @__PURE__ */
|
|
43
|
-
|
|
46
|
+
/* @__PURE__ */ o(u, { ...l, className: t.logo }),
|
|
47
|
+
s && h && /* @__PURE__ */ o(w, { expanded: r === "search", children: /* @__PURE__ */ o(x, { ...s, expanded: r === "search", onClose: a, onFocus: c }) }),
|
|
48
|
+
/* @__PURE__ */ n(F, { children: [
|
|
49
|
+
p && /* @__PURE__ */ o(G, { ...p }),
|
|
50
|
+
/* @__PURE__ */ n("div", { className: t.relative, children: [
|
|
51
|
+
/* @__PURE__ */ o(
|
|
52
|
+
I,
|
|
44
53
|
{
|
|
45
|
-
badge:
|
|
46
|
-
currentAccount:
|
|
47
|
-
onClick:
|
|
48
|
-
expanded:
|
|
49
|
-
label:
|
|
54
|
+
badge: v,
|
|
55
|
+
currentAccount: m,
|
|
56
|
+
onClick: S,
|
|
57
|
+
expanded: r === "menu",
|
|
58
|
+
label: e == null ? void 0 : e.menuLabel
|
|
50
59
|
}
|
|
51
60
|
),
|
|
52
|
-
|
|
53
|
-
|
|
61
|
+
e && /* @__PURE__ */ o(
|
|
62
|
+
B,
|
|
54
63
|
{
|
|
55
64
|
layout: "desktop",
|
|
56
65
|
padding: !0,
|
|
57
66
|
placement: "right",
|
|
58
|
-
open:
|
|
59
|
-
className:
|
|
60
|
-
children: /* @__PURE__ */
|
|
67
|
+
open: r === "menu",
|
|
68
|
+
className: t.dropdown,
|
|
69
|
+
children: /* @__PURE__ */ o(
|
|
70
|
+
f,
|
|
71
|
+
{
|
|
72
|
+
...e,
|
|
73
|
+
menu: _ || (e == null ? void 0 : e.menu),
|
|
74
|
+
currentAccount: m,
|
|
75
|
+
onClose: d
|
|
76
|
+
}
|
|
77
|
+
)
|
|
61
78
|
}
|
|
62
79
|
)
|
|
63
80
|
] })
|
|
64
81
|
] }),
|
|
65
|
-
|
|
66
|
-
|
|
82
|
+
s && !h && /* @__PURE__ */ o(w, { expanded: r === "search", children: /* @__PURE__ */ o(x, { ...s, expanded: r === "search", onClose: a, onFocus: c }) }),
|
|
83
|
+
e && /* @__PURE__ */ o(D, { open: r === "menu", className: t.drawer, children: /* @__PURE__ */ o(
|
|
84
|
+
f,
|
|
85
|
+
{
|
|
86
|
+
...e,
|
|
87
|
+
menu: C || (e == null ? void 0 : e.menu),
|
|
88
|
+
currentAccount: m,
|
|
89
|
+
onClose: d
|
|
90
|
+
}
|
|
91
|
+
) })
|
|
67
92
|
]
|
|
68
93
|
}
|
|
69
94
|
);
|
|
70
95
|
};
|
|
71
96
|
export {
|
|
72
|
-
|
|
97
|
+
A as Header
|
|
73
98
|
};
|
|
@@ -1,14 +1,18 @@
|
|
|
1
|
-
import { Header as
|
|
1
|
+
import { Header as o } from "./Header.js";
|
|
2
2
|
import { HeaderBase as a } from "./HeaderBase.js";
|
|
3
|
-
import { HeaderLogo as
|
|
3
|
+
import { HeaderLogo as f } from "./HeaderLogo.js";
|
|
4
4
|
import { HeaderButton as x } from "./HeaderButton.js";
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
5
|
+
import { HeaderGroup as H } from "./HeaderGroup.js";
|
|
6
|
+
import { HeaderSearch as u } from "./HeaderSearch.js";
|
|
7
|
+
import { LocaleButton as L } from "./LocaleButton.js";
|
|
8
|
+
import { LocaleSwitcher as l } from "./LocaleSwitcher.js";
|
|
7
9
|
export {
|
|
8
|
-
|
|
10
|
+
o as Header,
|
|
9
11
|
a as HeaderBase,
|
|
10
12
|
x as HeaderButton,
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
13
|
+
H as HeaderGroup,
|
|
14
|
+
f as HeaderLogo,
|
|
15
|
+
u as HeaderSearch,
|
|
16
|
+
L as LocaleButton,
|
|
17
|
+
l as LocaleSwitcher
|
|
14
18
|
};
|