@altinn/altinn-components 0.36.1 → 0.36.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,86 +1,88 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
import { jsxs as
|
|
3
|
-
import { DropdownBase as
|
|
2
|
+
import { jsxs as c, jsx as e } from "react/jsx-runtime";
|
|
3
|
+
import { DropdownBase as h } from "../Dropdown/DropdownBase.js";
|
|
4
4
|
import "../../index-L8X2o7IH.js";
|
|
5
|
-
import { DrawerBase as
|
|
5
|
+
import { DrawerBase as f } from "../Dropdown/DrawerBase.js";
|
|
6
6
|
import "react";
|
|
7
|
-
import { useRootContext as
|
|
8
|
-
import { GlobalMenu as
|
|
9
|
-
import { GlobalMenuButton as
|
|
10
|
-
import { HeaderBase as
|
|
11
|
-
import { HeaderLogo as
|
|
12
|
-
import { LocaleButton as
|
|
13
|
-
import { LocaleSwitcher as
|
|
14
|
-
import { Searchbar as
|
|
7
|
+
import { useRootContext as b } from "../RootProvider/RootProvider.js";
|
|
8
|
+
import { GlobalMenu as w } from "../GlobalMenu/GlobalMenu.js";
|
|
9
|
+
import { GlobalMenuButton as j } from "../GlobalMenu/GlobalMenuButton.js";
|
|
10
|
+
import { HeaderBase as B } from "./HeaderBase.js";
|
|
11
|
+
import { HeaderLogo as H } from "./HeaderLogo.js";
|
|
12
|
+
import { LocaleButton as L } from "./LocaleButton.js";
|
|
13
|
+
import { LocaleSwitcher as g } from "./LocaleSwitcher.js";
|
|
14
|
+
import { Searchbar as u } from "../Searchbar/Searchbar.js";
|
|
15
15
|
import "../Snackbar/useSnackbar.js";
|
|
16
|
-
import { HeaderGroup as
|
|
17
|
-
import { HeaderSearch as
|
|
18
|
-
import
|
|
19
|
-
|
|
16
|
+
import { HeaderGroup as S } from "./HeaderGroup.js";
|
|
17
|
+
import { HeaderSearch as v } from "./HeaderSearch.js";
|
|
18
|
+
import { useIsDesktop as D } from "../../hooks/useIsDesktop.js";
|
|
19
|
+
import '../../assets/Header.css';const I = "_drawer_1vzjh_1", y = "_dropdown_1vzjh_5", z = "_relative_1vzjh_19", a = {
|
|
20
|
+
drawer: I,
|
|
20
21
|
dropdown: y,
|
|
21
22
|
relative: z
|
|
22
|
-
},
|
|
23
|
-
const { currentId: o, toggleId: t, openId:
|
|
24
|
-
|
|
25
|
-
},
|
|
23
|
+
}, Z = ({ menu: r, locale: n, search: s, currentAccount: l, logo: x = {}, badge: C }) => {
|
|
24
|
+
const { currentId: o, toggleId: t, openId: _, closeAll: d } = b(), p = () => {
|
|
25
|
+
_("search");
|
|
26
|
+
}, i = () => {
|
|
26
27
|
t("search");
|
|
27
|
-
},
|
|
28
|
+
}, N = () => {
|
|
28
29
|
t("menu");
|
|
29
|
-
},
|
|
30
|
+
}, k = () => {
|
|
30
31
|
t("locale");
|
|
31
|
-
};
|
|
32
|
-
return /* @__PURE__ */
|
|
33
|
-
|
|
32
|
+
}, m = D();
|
|
33
|
+
return /* @__PURE__ */ c(
|
|
34
|
+
B,
|
|
34
35
|
{
|
|
35
36
|
currentId: o,
|
|
36
37
|
open: o === "search" || o === "menu" || o === "locale",
|
|
37
38
|
onClose: d,
|
|
38
39
|
children: [
|
|
39
|
-
/* @__PURE__ */ e(
|
|
40
|
-
/* @__PURE__ */
|
|
41
|
-
|
|
42
|
-
/* @__PURE__ */
|
|
40
|
+
/* @__PURE__ */ e(H, { ...x, className: a.logo }),
|
|
41
|
+
s && m && /* @__PURE__ */ e(v, { expanded: o === "search", children: /* @__PURE__ */ e(u, { ...s, expanded: o === "search", onClose: i, onFocus: p }) }),
|
|
42
|
+
/* @__PURE__ */ c(S, { children: [
|
|
43
|
+
n && /* @__PURE__ */ e("div", { className: a.relative, children: /* @__PURE__ */ e(L, { onClick: k, expanded: o === "locale" }) }),
|
|
44
|
+
/* @__PURE__ */ c("div", { className: a.relative, children: [
|
|
43
45
|
/* @__PURE__ */ e(
|
|
44
|
-
|
|
46
|
+
j,
|
|
45
47
|
{
|
|
46
|
-
badge:
|
|
47
|
-
currentAccount:
|
|
48
|
-
onClick:
|
|
48
|
+
badge: C,
|
|
49
|
+
currentAccount: l,
|
|
50
|
+
onClick: N,
|
|
49
51
|
expanded: o === "menu",
|
|
50
52
|
label: r == null ? void 0 : r.menuLabel
|
|
51
53
|
}
|
|
52
54
|
),
|
|
53
|
-
|
|
54
|
-
|
|
55
|
+
n && /* @__PURE__ */ e(
|
|
56
|
+
h,
|
|
55
57
|
{
|
|
56
58
|
layout: "desktop",
|
|
57
59
|
padding: !0,
|
|
58
60
|
placement: "right",
|
|
59
61
|
open: o === "locale",
|
|
60
62
|
className: a.dropdown,
|
|
61
|
-
children: /* @__PURE__ */ e(
|
|
63
|
+
children: /* @__PURE__ */ e(g, { ...n })
|
|
62
64
|
}
|
|
63
65
|
),
|
|
64
66
|
r && /* @__PURE__ */ e(
|
|
65
|
-
|
|
67
|
+
h,
|
|
66
68
|
{
|
|
67
69
|
layout: "desktop",
|
|
68
70
|
padding: !0,
|
|
69
71
|
placement: "right",
|
|
70
72
|
open: o === "menu",
|
|
71
73
|
className: a.dropdown,
|
|
72
|
-
children: /* @__PURE__ */ e(
|
|
74
|
+
children: /* @__PURE__ */ e(w, { ...r, currentAccount: l, onClose: d })
|
|
73
75
|
}
|
|
74
76
|
)
|
|
75
77
|
] })
|
|
76
78
|
] }),
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
r && /* @__PURE__ */ e(
|
|
79
|
+
s && !m && /* @__PURE__ */ e(v, { expanded: o === "search", children: /* @__PURE__ */ e(u, { ...s, expanded: o === "search", onClose: i, onFocus: p }) }),
|
|
80
|
+
n && /* @__PURE__ */ e(f, { open: o === "locale", className: a.drawer, children: /* @__PURE__ */ e(g, { ...n }) }),
|
|
81
|
+
r && /* @__PURE__ */ e(f, { open: o === "menu", className: a.drawer, children: /* @__PURE__ */ e(w, { ...r, currentAccount: l, onClose: d }) })
|
|
80
82
|
]
|
|
81
83
|
}
|
|
82
84
|
);
|
|
83
85
|
};
|
|
84
86
|
export {
|
|
85
|
-
|
|
87
|
+
Z as Header
|
|
86
88
|
};
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { useState as s, useEffect as r } from "react";
|
|
3
|
+
const e = 1024, d = () => {
|
|
4
|
+
const [i, n] = s(() => typeof window > "u" ? !1 : window.innerWidth >= e);
|
|
5
|
+
return r(() => {
|
|
6
|
+
n(window.innerWidth >= e);
|
|
7
|
+
const t = () => {
|
|
8
|
+
n(window.innerWidth >= e);
|
|
9
|
+
};
|
|
10
|
+
return window.addEventListener("resize", t), () => window.removeEventListener("resize", t);
|
|
11
|
+
}, []), i;
|
|
12
|
+
};
|
|
13
|
+
export {
|
|
14
|
+
d as useIsDesktop
|
|
15
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const useIsDesktop: () => boolean;
|